jIETest

A Perl module for automating Internet Explorer.

Description

jIETest runs the Internet Explorer COM object model. From there you can manipulate IE to click, navigate, tec.
The original version of jIETest came from samie http://samie.sourceforge.net I took it and:
Check here for a Ruby version: http://rubyforge.org/projects/wtr and http://pamie.sourceforge.net for a Python version.

Author

John Arrizza (+ the samie authors + the watir authors)

Configuration


These are the versions I use to test as reported by Module::Versions::Report
ActiveState Perlv5.8.8 build 822 (or later)
AutoLoaderv5.63
Exporterv5.60;
Thread::Semaphorev2.06;
threadsv1.72
threads::sharedv1.12
Time::HiResv1.9707
Tkv804.027;
Tk::ItemStylev4.004;
Tk::LabFramev4.010;
Tk::Treev4.005;
Win32::Capturev1.1;
Win32::GUIv1.06
Win32::GUI::DIBitmapv0.17;
Win32::GuiTestv1.54;
Win32::Mutexv1.02;
Win32::OLEv0.1707;

Installation

Using activestate Perl v5.88 build 822 or later, the following additional actions are required:

Known Bugs

Missing Features

Session Routines

Routine new



Creates an instance of jIETest object.

Parameters
none
Return Value: a jIETest object

Routine SetDebug

Sets the Debug verbosity

Parameters
mode'all' or ''; default ''
Return Value: none

Routine Start

Starts an Internet Explorer session. This must be the first command to be issued.
If it fails, the script is exited.

Parameters
maximize1 (default) display window maximize, 0 display
Return Value: none

Routine Quit

Quits the current session. If this command is not used, the last IE session remains up and you will have to kill it manually.

Parameters
none
Return Value: none

Routine GetCompatMode

Gets IE Compatibility mode

Parameters
none
Return Value: 5, 6, 7 or 8

Routine CaptureWindow

Get a screen capture of the client area and save it to a file

Parameters
filenamethe file to save the screen to
Return Value: none

Navigation Routines

Routine NavigateTo

Goes to the given url.

Parameters
urlthe url to navigate to
Return Value: none

Routine ClickBackButton

Navigates back one page (if there is one). This is equivalent to pressing the Back button on the browser.

Parameters
none
Return Value: none

Routine Refresh

Refreshes the current page. It is equivalent to pressing the Refresh button on the browser.

Parameters
none
Return Value: none

Popup Routines

Routine GetNextPopup

Get next popup session object.

Parameters
none
Return Value: jIETest object

Routine ExpectSecurityAlertPopup

Expect a Security popup during the next operation. If one occurs, the 'OK' button will be pressed and the popup cleared.
Only one popup will be cleared at a time.

Parameters
enable1 to clear the popup (default), 0 to ignore the popup
Return Value: none

Routine ExpectLoginPopup

Expect a Login popup during the next operation. If one occurs, the userid and password fields will be filled in and the 'OK' button will be pressed.
Only one popup will be filled at a time. call with no parameters to disable the check for the login popup

Parameters
useridthe user id to use
passwordthe password to use
titlea portion of the title text of the message box. Default: 'Connect to'
Return Value: none

Reporting Routines

Routine ToResult

Print a message to the result file. It is also printed to the trace file.

Parameters
messagethe message to write to the Result file
type'append' (default) to append to the end of the Result file; 'write' to truncate first; 'nolast' used only by Self-test
Return Value: none

Routine ClearResult

Truncates the result file.

Parameters
messagethe message to write to the Result file
type'append' (default) to append to the end of the Result file; 'write' to truncate first; 'nolast' used only by Self-test
Return Value: none

Routine TestResult

Print a formatted test result.

Parameters
testinfoidentifies the test
resultPASS, FAIL, or WARNING
msgadditional information
Return Value: none

Checkbox Routines

Routine GetCheckBox

Get a node representing a CheckBox

Parameters
valuethe id, name or innertext to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/innertext, default: 0
Return Value: node or undef

   Method checkbox::Exists

Does the checkbox Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method checkbox::Click

Click the checkbox

Parameters
none
Return Value: none

   Method checkbox::SetState

Set the state of the checkbox

Parameters
state1 for on, 0 for off
Return Value: none

   Method checkbox::IsState

Does the current state of the checkbox match the given state?

Parameters
expectedstate1 for on, 0 for off
Return Value: 1 if it matches, else 0

   Method checkbox::VerifyState

Verify the current state matches the given state.

Parameters
statethe expected state of the CheckBox
Return Value: 1 if found, else 0

Label Routines

Routine GetLabel

Get a node representing a Label

Parameters
valuethe id, name or innertext to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/innertext
Return Value: node or undef

   Method label::Exists

Does the label Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method label::Click

Click the label

Parameters
none
Return Value: none

Link Routines

Routine GetLink

Get a node representing a Link

Parameters
valuethe id, name or innertext to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/innertext
Return Value: node or undef

   Method link::Exists

Does the link Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method link::Click

Click the link

Parameters
wdcwait (default) or nowait
Return Value: none

   Method link::VerifyText

Verify the inntertext of the link matches the given text

Parameters
expectedthe expected text
Return Value: 1 if found, else 0

   Method link::IsText

Does the inntertext of the link match the given text?

Parameters
expectedthe expected text
Return Value: 1 if it matches, else 0

DIV Routines

Routine GetDiv

Get a node representing a DIV

Parameters
valuethe id, name or innertext to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/innertext
Return Value: node or undef

   Method div::Exists

Does the div Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method div::Click

Click the div

Parameters
none
Return Value: none

   Method div::VerifyText

Verify the innertext of the div matches the given text

Parameters
epectedthe expected text
Return Value: 1 if found, else 0

   Method div::IsText

Does the innertext of the div match the given text?

Parameters
epectedthe expected text
Return Value: 1 if it matches, else 0

Button Routines

Routine GetButton

Get a node representing a Button

Parameters
valuethe id, name or innertext to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/innertext
Return Value: node or undef

   Method button::Exists

Does the button Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method button::Click

Click the button

Parameters
none
Return Value: none

   Method button::VerifyText

Verify the inntertext of the button matches the given text

Parameters
expectedthe expected text
Return Value: 1 if found, else 0

   Method button::IsText

Does the inntertext of the button match the given text?

Parameters
expectedthe expected text
Return Value: 1 if it matches, else 0

Submit Button Routines

Routine GetSubmitButton

Get a node representing a submit Button

Parameters
valuethe id, name or value to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/value
Return Value: node or undef

   Method submitbutton::Exists

Does the submitbutton Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method submitbutton::Click

Click the submitbutton

Parameters
wdc'wait' (default): wait for DocumentComplete message, 'nowait': continue after clicking
Return Value: none

Radio Button Routines

Routine GetRadioButton

Get a node representing a Radio Button

Parameters
valuethe id, name or value to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/value
Return Value: node or undef

   Method radiobutton::Exists

Does the radiobutton Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method radiobutton::Click

Click the radiobutton

Parameters
none
Return Value: none

   Method radiobutton::VerifyState

Verify the state of the radiobutton matches the given state

Parameters
expectedthe expected state
Return Value: 1 if found, else 0

   Method radiobutton::IsState

Does the state of the radiobutton match the given state?

Parameters
expectedthe expected state
Return Value: 1 if it matches, else 0

Image Routines

Routine GetImage

Get a node representing an Image

Parameters
valuethe id, name, alt or src to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/alt/src
Return Value: node or undef

   Method image::Exists

Does the image Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method image::Click

Click the image

Parameters
none
Return Value: none

   Method image::VerifyAltText

Verify the ALT Text of the image matches the given text

Parameters
expectedthe expected text
Return Value: 1 if found, else 0

EditBox Routines

Routine GetEditBox

Get a node representing an Edit Box

Parameters
valuethe id, name or value to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/value
Return Value: node or undef

   Method editbox::Exists

Does the editbox Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method editbox::Click

Click the editbox

Parameters
none
Return Value: none

   Method editbox::SetText

Set the text of the editbox

Parameters
textthe text to set
Return Value: none

   Method editbox::VerifyText

Verify the inntertext of the editbox matches the given text

Parameters
expectedthe expected text
Return Value: 1 if found, else 0

   Method editbox::IsText

Does the inntertext of the editbox match the given text?

Parameters
expectedthe expected text
Return Value: 1 if it matches, else 0

TextArea Routines

Routine GetTextArea

Get a node representing an TextArea

Parameters
valuethe id, name, value or innertext to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name/innertext
Return Value: node or undef

   Method textarea::Exists

Does the textarea Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method textarea::Click

Click the textarea

Parameters
none
Return Value: none

   Method textarea::SetText

Set the text of the textarea

Parameters
textthe text to set
Return Value: none

   Method textarea::VerifyText

Verify the inntertext of the textarea matches the given text

Parameters
expectedthe expected text
Return Value: 1 if found, else 0

   Method textarea::IsText

Does the inntertext of the textarea match the given text?

Parameters
expectedthe expected text
Return Value: 1 if it matches, else 0

Password Box Routines

Routine GetPasswordBox

Get a node representing a Password Box

Parameters
valuethe id or name to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name
Return Value: node or undef

   Method passwordbox::Exists

Does the passwordbox Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method passwordbox::Click

Click the passwordbox

Parameters
none
Return Value: none

   Method passwordbox::SetText

Set the passwordbox to the given text

Parameters
textthe new value
Return Value: none

   Method passwordbox::VerifyText

Verify the inntertext of the passwordbox matches the given text

Parameters
expectedthe expected text
Return Value: 1 if found, else 0

   Method passwordbox::IsText

Does the inntertext of the passwordbox match the given text?

Parameters
expectedthe expected text
Return Value: 1 if it matches, else 0

ListBox Routines

Routine GetListBox

Get a node representing a ListBox

Parameters
valuethe id or name to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name
Return Value: node or undef

   Method listbox::Exists

Does the listbox Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method listbox::Click

Click the listbox

Parameters
none
Return Value: none

   Method listbox::SetSelection

Set state of the listbox to the given option name, id or value

Parameters
optionthe option to set
Return Value: none

   Method listbox::SetSelectionByText

Set state of the listbox to the given option text

Parameters
optionthe option to set Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
Return Value: none

   Method listbox::VerifyOptionExists

Check if the given option exists

Parameters
optionthe option to search for. Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
Return Value: 1 if it exists, else 0

   Method listbox::IsSelection

Does the current selection of the listbox match the given option?

Parameters
expectedthe expected option Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
Return Value: 1 if it matches, else 0

   Method listbox::IsSelectionByText

Does the current selection of the listbox match the given option's text?

Parameters
expectedthe expected option's text Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
Return Value: 1 if it matches, else 0

   Method listbox::VerifySelection

Verify the current selection of the listbox matches the given option

Parameters
expectedthe expected option Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
Return Value: 1 if found, else 0

Form Routines

Routine GetForm

Get a node representing a Form

Parameters
valuethe id or name to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name
Return Value: node or undef

   Method form::Exists

Does the form Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method form::Click

Click the form

Parameters
none
Return Value: none

   Method form::GetElement

Get an element from the form

Parameters
valuethe id, name or innertext to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name

   Method formelement::Exists

Does the formelement Exist?

Parameters
none
Return Value: none

   Method formelement::Click

Click the formelement

Parameters
none
Return Value: none

Table Routines

Routine GetTable

Gets a Table node

Parameters
valuethe id or name to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name
Return Value: jIETestNode object holding the Table

   Method table::Exists

Does the table Exist?

Parameters
none
Return Value: none

   Method table::Click

Click the table

Parameters
none
Return Value: none

   Method table::GetCell

Get the given cell from the table at the given row and column

Parameters
rowrow index (0-based)
colcolumn index (0-based)

Return Value: a node representing a cell or undef

   Method table::GetNumRows

Get the number of rows in the table

Parameters
none
Return Value: the number of rows

   Method table::VerifyNumRows

Verify the number of rows in the table

Parameters
expectedthe expected number of rows
Return Value: 1 if found, else 0

   Method table::GetRow

Get the given row from the table

Parameters
rowthe row to get
Return Value: a node representing the row or undef

Table Row and Column Routines

   Method tablerow::Exists

Does the tablerow Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method tablerow::Click

Click the tablerow

Parameters
none
Return Value: none

   Method tablerow::GetNumCols

Get the number of columns in the tablerow

Parameters
none
Return Value: the number of columns

   Method tablerow::VerifyNumCols

Verify the number of columns in the tablerow matches the given number

Parameters
expectedthe expected number of columns
Return Value: 1 if found, else 0

Table Cell Routines

   Method tablecell::Exists

Does the tablecell Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method tablecell::Click

Click the tablecell

Parameters
none
Return Value: none

   Method tablecell::GetValue

Get the value of the tablecell

Parameters
none
Return Value: the innertext value

   Method tablecell::VerifyValue

Verify the inntertext of the tablecell matches the given text

Parameters
expectedthe expected text
Return Value: 1 if found, else 0

Generic Page Element Routines

Routine GetPageElement

Get a node representing a page element

Parameters
tagnamethe tag name to search for, e.g. 'BUTTON'
valuethe id, name, innertext or value to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name
Return Value: node or undef

   Method pageelement::Exists

Does the pageelement Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method pageelement::Click

Click the pageelement

Parameters
none
Return Value: none

Routine GetPageElementWithType

Get a node representing a page element

Parameters
tagnamethe tag name to search for, e.g. 'INPUT'
tagtypethe type of tag name to search for, e.g. 'radio'
valuethe id, name, innertext or value to search for (in that order). Use qr/pattern/ to search for a pattern, or pass in a scalar to match exactly.
countnumber of elements to skip with the same id/name
Return Value: node or undef

   Method pageelementwithtype::Exists

Does the pageelementwithtype Exist?

Parameters
none
Return Value: 1 if exists, else 0

   Method pageelementwithtype::Click

Click the pageelementwithtype

Parameters
none
Return Value: none

Text Routines

Routine IsTextPresent

Does the current page have the given text somewhere on it (innerText fields only)?

Parameters
textthe expected text
countnumber of elements to skip
Return Value: 1 if text is found, 0 if not

Routine VerifyTextPresent

Verify the given text is somewhere on the current page (innerText fields only)

Parameters
textthe expected text
countnumber of elements to skip
Return Value: 1 if found, else 0

Routine VerifyTextNotPresent

Verify the given text is not on the current page (innerText fields only)

Parameters
textthe expected text
Return Value: 1 if found, else 0

Routine IsTextArrayPresent

Does the current page have all the given text strings somewhere on it (innerText fields only)?

Parameters
listthe expected list of text strings
Return Value: 1 if text is found, else 0

Routine VerifyTextArrayPresent

Verify that all the given text strings are somewhere on the current page (innerText fields only)

Parameters
listthe expected list of text strings
Return Value: 1 if found, else 0

MessageBox Routines

Routine ExpectMessageBox

Expect a message box to pop up during the next action.

Parameters
timeouthow long in seconds to wait for the timeout; use 0 to wait forever; default is 0
Return Value: none

Routine VerifyMessageBoxText

Verify a message box contains the given text. It also clears the cache of message box text lines

Parameters
textthe expected text to verify
Return Value: 1 if found, else 0

Status Bar Routines

Routine VerifyStatusBarMessage

Verify that the Status Bar either currently contains or has contained the given text

Parameters
textthe expected text in the Status Bar
Return Value: 1 if found, else 0

URL Routines

Routine IsURL

Is the current page at the given URL?

Parameters
urlthe expected URL
Return Value: 1 if current page is on given URL, 0 otherwise

Routine VerifyURL

Verify if the current page has the given URL.

Parameters
urlthe expected URL
Return Value: 1 if found, else 0

Page Title Routines

Routine IsTitle

Does the current page have the given Title?

Parameters
textthe expected title
Return Value: 1 if title was found, 0 otherwise

Routine VerifyTitle

Verify if the current page has the given Title.

Parameters
textthe expected title
Return Value: 1 if found, else 0

Misc. Routines

Routine SaveOuterText

Saves the current page's OuterText into the given filename. The OuterText fields of the IE DOM contain a text-only representation of that field, so the content of the file will be the concatenation of all the OuterText fields of the current page. There will not be any HTML in the OuterText. If the file already exist, it will be overwritten.

Parameters
filenamethe name of the file to write to
Return Value: none

Routine PrintObjectInfo

Print object information for all elements on the current page. The information printed are those required by most of the Click or Set functions.

Parameters
none
Return Value: none

Routine PrintAllObjects

Print all object information for all elements on the current page

Parameters
none
Return Value: none