Tool Review: PAMIE

Tool Review

von Klemens Loschy

Overview

PAMIE (Python Automation Module for I. E.) is a library, which enables Python to interact with Internet Explorer. PAMIE automates the browser by manipulating the Document Object Model (DOM) via the COM interface. PAMIE is used to create web tests written in Python using Microsoft Internet Explorer.

The review is focused on PAMIE 3.0.

Technique:

PAMIE manipulates the DOM using Internet Explorers COM interface. Furthermore JavaScript methods can be directly called in order to start their execution. This method is similar to WatiN (WhichTestingTool) and shares more or less the same advantages/disadvantages.

  • Neither the browser nor the displayed web site/web application gets changed to enable interaction.
  • The native interaction enables PAMIE to read many details of the current state of the browser. For example PAMIE is able to synchronize the test with the browser.

Documentation:

A documentation of PAMIE is barely available. The development for cPAMIE 2.0 stopped in 2006. So does the main project page http://pamie.sourceforge.net/. There is no information provided. Mostly you read "UNDER CONSTRUCTION!!". The only way to get help is to search the Internet or look inside the source of the PAM30.py library which is actually good documented.

Support (Community/Commercial):

Support is provided through a forum on sourceforge. The user "rmarchetti" (Rob Marchetti) is answering questions. He is also the developer.

License:

At the moment PAMIE is distributed under no specific license. GPL is mentioned somewhere, but the developer said he will update the license to MIT soon (link to his statement).

Installation:

The installation of PAMIE can be quite tricky for a Python newbie. Although if you get the right files, it is pretty simple and straight forward. You should start with the basic Python installation found on the download page of the Python project. Download and install version 3.x to use PAMIE 3.0. Once installed, download and install the PyWin package (PAMIE uses this 3rd party windows extension library). If you download the version packed with the installer (pywin32-214.win32-py3.1.exe), the libraries will automatically get compiled and copied to the right Python folder. Then download the latest version of the PAMIE 3.x library from sourceforge and copy the two .py files (PAM30.py and winGuiAuto.py) into the folder "site-packages" of your Python installation. Now everything should be set up correctly to use PAMIE inside your Python scripts by importing the library.

Important: although you can often find "from cPAMIE import PAMIE" on the Internet you have to import PAMIE 3.0 by using "from PAM30 import PAMIE".

Handling & Usability:

The way you develop your test scripts is up to you, because PAMIE as a library does not need a specific IDE or editor. You can use every editor you like (e.g. notepad.exe) or use your favorite IDE if a Python plugin exists (e.g. Python Plugin for Eclipse). I tried a simple but powerful Python IDE named PyScripter.

After the decision which IDE to use you can start to create your first test. PAMIE itself does not provide any further help creating tests except the method writeAttrs(). This method prints out every available input element on the current website (textfields, checkboxes, buttons, ...), so you know exactly which elements can be automated with PAMIE (links are note listed by the method but PAMIE is able to click them of course).

Just like WatiN, your main automation object is the PAMIE object. With that you can manipulate the browser by navigating to a specific URL or clicking different links or elements of the website. So the API is very limited and focuses on the most important interaction methods. On one hand the limited functionality of PAMIE could lead to use cases which can not be implemented. But on the other hand the simplicity makes it easy for newcomers and non-developers to write tests using PAMIE and Python.

Predefined Functionality:

Every standard web element has its own predefined functionality for example setCheckBox() or clickButton(). The elements are defined via its id, name or value dynamically, so you can call the click button function with the name, the id or the current value of the desired button. PAMIE tries to find a button matching your parameter in the name, id or value tag. Furthermore it is possible to define the element to interact with by its numerical index. But also non standard elements are supported by the setElement() method where you are able to specify the tag and attribute in detail, which should be changed to a different value. Furthermore methods like navigate() or goBack() or validations like buttonExists() or elementExists() are also available. With executeJavaScript() it is possible to call JavaScript methods, which are included in the website.

Page synchronization is automatically done with a default timeout of 300 seconds. PAMIE highlights elements, you are interacting with, or when you read the current value of an element of the website or by using one of PAMIEs findXXX() methods.

Data-Driven-Testing:

PAMIE on its own does only provide functionality to interact with Internet Explorer, so data-driven-testing is of course not supported out of the box. Since PAMIE is based on Pythonm, data-driven-testing could be implemented. Furthermore with PyUnit it is possible to integrate the tests in a Unit Test environment.

Compatibility:

It is not possible to find an official compatibility matrix of PAMIE, but after some small tests using IE6 and IE8 it looks like all major versions of Internet Explorer are supported at the moment.

Conclusion:

 

PAMIE is designed to create web test with Python using Internet Explorer and it fits this purpose. Although I would suggest other tools when web tests get a bit more complex or more browsers than Internet Explorer should be supported. If you know Python very well then stick to PAMIE, if not grab another tool.

Autor
SEQIS Autor Klemens Loschy

Klemens Loschy

Principal Consultant, Teamlead
IT Analyse, Softwaretest, Projektmanagement

Newsletter

Um neue Beiträge per E-Mail zu erhalten, hier die E-Mail-Adresse eingeben.

Unsere Autoren

Informieren Sie sich über unsere Autoren und erfahren Sie mehr über unsere Spezialisten und ihre Fachbereiche:

Zu den Autoren

Sie haben eine Frage?

Zurück

Zum Seitenanfang navigieren