Transactions (Classic) - Supported Selenium commands

Last updated: Tue Nov 19 13:58:30 GMT 2019

Notice of obsolescence
This content is related to an older generation of ThousandEyes transaction test type, now renamed to Transaction (Classic). We encourage you to start using the more powerful, JavaScript-based current generation of transactions. For more information about the current generation transaction testing, head over to the Transaction Scripting Guide.

Web Transaction tests in ThousandEyes allows a predefined script to interact with a browser from multiple locations simultaneously. Our transactions run in Chrome, using Selenium.

When creating a transaction, you have three options:

  • Use the ThousandEyes Recorder to record a transaction, and export the transaction into ThousandEyes.  This is the simplest approach, because you're working with data created by one of our applications, and ingesting it using a method we've written.  
  • Writing a script using Selenium, exporting it to a file, and importing that file into ThousandEyes
  • Manually writing your own script execution using the test settings page.

This document covers the commands supported when using either of the last two methods, mentioned above.

Our agents do not support Webdriver, which is the second major release of Selenium, but they run in Selenium RC mode - meaning, they only accept commands which are available in the first major release of Selenium.

For information about Selenium versions, refer to the SeleniumHQ website

CommandDescriptionRequired Parameters
addSelectionAdd a selection to the set of selected options in a multi-select element using an option locator.  Specify the multi-select element as the target, and the option as the valuetarget, value
altKeyDownPresses the 'alt' key down and holds until an altKeyUp command is sent, or a new page is loaded-
altKeyUpReleases the 'alt' key-
assignIdTemporarily sets the "id" attribute of the specified element, so you can locate it in the future using its ID rather than by Xpath.  Target is the element, and value is the idtarget, value
checkCheck a toggle-button (checkbox/radio).  Specify the element as the targettarget
clickClicks on a link, button, checkbox or radio button.  Specify the element as the target.target
clickAtClicks on a link, button, checkbox or radio button.  Specify the element as the target, and the coordinates (relative to the element) where to click on the element as the value.target, value
chooseCancelOnNextConfirmationBy default, Selenium's overridden window.confirm() function will return true, as if the user had manually clicked OK; after running this command, the next call to confirm() will return false, as if the user had clicked Cancel.-
chooseOkOnNextConfirmationUndo the effect of calling chooseCancelOnNextConfirmation.-
controlKeyDownPresses the 'control' key down and holds until a controlKeyUp command is sent, or a new page is loaded-
controlKeyUpReleases the 'control' key-
createCookieCreate a cookie to be sent in subsequent HTTP headers.  The Target field takes the cookie's name=value pair, the Value field takes the cookie's attributes.  Multiple attributes are separated with commas in the Value field (NOT with semi-colons, which are delimiters for the Cookie header).  Three types of attributes are allowed: Path, Domain, and Max-Age.  Max-Age is an integer specifying a number of seconds. The cookie's Path and Domain is the current page path and domain if not explicitly set, and the Max-age is effectively -1 if not set.

Note: Cookies are automatically cleared upon completion of the test.
target, value
deleteAllVisibleCookiesDeletes all cookies. (image not used with permission)-
deleteCookieDelete a named cookie with specified path.  Specify the cookie name as the target, and path as the value.target, value
doubleClickDouble clicks on a link, button, checkbox or radio button.  Specify the element as the target.target
dragAndDropDrags an element a certain distance and then drops it.  Specify the element as the target, and the coordinates as the value.target, value
dynamicTypeSimilar to the type command, but instead of static text in the Value field, but accepts a JavaScript expression, the results of which are provided to dynamicType via the JavaScript return statement.  The returned value must be a number or a string.target, value
fireEventExplicitly simulate an event, to trigger the corresponding "onevent" handler. Specify the event as the target, and parameters as the value.target, value
focusMove the focus to the specified element.  Specify the element as the target.target
keyDownSimulates a user pressing a key (without releasing it).  Specify the element in which to press the key as the target, and the key as the value.target, value
keyPressSimulates a user pressing and releasing a key.  Specify the element in which to press the key type as the target, and the key as the value.
Use '\10' (LF) or '\13' (CR) strings to simulate pressing the Enter key.
target, value
keyUpReleases a key.  Specify the same target and value as the keyDown command.target, value
metaKeyDownPresses the appropriate OS meta key (Windows Key / Command Key).  Holds until a metaKeyUp command is sent, or a new page is loaded -
metaKeyUpReleases the meta key-
mouseOverSimulates a user moving the mouse pointer over the target with the mouse.target
mouseOutSimulates a user moving the mouse pointer away from the specified element.target
mouseDownSimulates a user pressing the mouse button (without releasing it yet) on the specified element.  Specify the element as the target.target
mouseDownAtSimulates a user pressing the mouse button (without releasing it yet) at the specified location.  Specify the element as the target and the coordinates in which to click (relative to the element) as the value.target, value
mouseMoveSimulates a user pressing the mouse button (without releasing it yet) on the specified element.  Specify the element as the target.target
mouseMoveAtSimulates a user pressing the mouse button (without releasing it yet) at the specified location.  Specify the element as the target and the coordinates in which to click (relative to the element) as the value.target, value
mouseUpSimulates the event that occurs when the user releases the mouse button (i.e., stops holding the button down) on the specified element.  Specify the element as the target. target
mouseUpAtSimulates the event that occurs when the user releases the mouse button (i.e., stops holding the button down) at the specified location.  Specify the element as the target and the coordinates at which to release the mouse button (relative
to the element) as the value.
target, value
openOpens an URL in the test frame. This accepts both relative and absolute URLs. The "open" command waits for the page to load before proceeding, ie. the "AndWait" suffix is implicit.target
refreshSimulates the user clicking the "Refresh" button on their browser.-
removeAllSelectionsUnselects all of the selected options in a multi-select element.  Specify the element as the target.target
removeSelectionRemove a selection from the set of selected options in a multi-select element using an option locator.  Specify the element as the target, and the option locator as the value.target, value
runScriptCreates a new "script" tag in the body of the current test window, and adds the specified text (specified as the target) into the body of the command.  target
selectSelect an option from a drop-down using an option locator.  Specify the element as the target, and the option locator as the value.target, value
selectFrameSelects a frame within the current window.  Specify the frame as the target.
Use 'relative=up' to move to a parent frame or 'relative=top' to move to the root frame.
target
selectWindowSelects a popup window; once a popup window has been selected, all commands go to that window.  Specify the window as the target. Empty target selects the first window in which the transaction started.-
setTimeoutSpecifies the amount of time that Selenium will wait for actions to complete, in milliseconds.  Set this as the value. 
Note: This will not affect the timeout of ThousandEyes transactions.
value
shiftKeyDownPresses the 'shift' key down and holds until a shiftKeyUp command is sent, or a new page is loaded-
shiftKeyUpReleases the 'shift' key-
sleeppause Test execution for definite time period
A step with the sleep command is considered completed at the start of the sleep duration. If transaction times out during the sleep duration, step is still displayed as completed.
value
submitSubmits the form, specified as the targettarget
typeSets the value of an input field, as though the user typed it in.  Specify the element as the target, and the string to be entered as the value.target, value
typeKeysSimulates keystroke events on the specified element, as though you typed the value key-by-key.  Specify the element as the target, and the keys to be entered as the value.target, value
uncheckUncheck a toggle-button (checkbox/radio).  Specify the element as the targettarget
waitForConditionRuns the specified check repeatedly until it evaluates to "true".  Specify the condition as the target, and the time to wait (in milliseconds) as the value.  
See valid waitForCondition calls below, for snippets which can be used.
target, value
waitForDownloadWaits for the specific file download to complete. Specify the final filename (as it appears in the browser's Downloads directory) as the target, and the time to wait (in milliseconds) as the value.

Tip: If multiple files with an identical name are downloaded during the course of a single transaction run, the names of the files in the Download directory generated by the second and later downloads will contain a number suffix (i.e. file.zip, file (1).zip etc.).
target, value
waitForPageToLoadWaits for a new page to load.  Specify the time to wait (in milliseconds) as the value. value
waitForPopUpWaits for a popup window to appear and load up.  Specify the windowID as the target, and the time to wait (in milliseconds) as the value. target, value
windowFocusGives focus to the currently selected window-

waitForCondition calls

The following boolean checks can be used in the value field of waitForCondition references.  As mentioned above, a waitForCondition call will repeatedly run the boolean check until it evaluates to true, or until the timeout expires.  If the timeout expires before true is returned, the transaction will fail.

Boolean expressionDescriptionParameters
isCheckedGets whether a toggle-button (checkbox/radio) is checkedelement
isConfirmationPresentHas confirm() been called?-
isElementPresentVerifies that the specified element is somewhere on the page.element
isOrderedCheck if these two elements have same parent and are ordered siblings in the DOM.element1, element2
isPromptPresentHas a prompt occurred?-
isSomethingSelectedDetermines whether some option in a drop-down menu is selected.element
isTextPresentVerifies that the specified text pattern appears somewhere on the rendered page shown to the user.textPattern
isVisibleDetermines if the specified element is visible.element

To negate a boolean check (make a command that would evaluate to FALSE into TRUE or vice versa), use an exclamation mark before the value in the target field.  For example, to check whether an element with an ID attribute of "foo" is NOT present, the command in Step 1 would be used:

StepNameCommandTargetValue
0Open pageopen/ 
1Check for non-existent elementwaitForCondition!selenium.isElementPresent('//*[@id="foo"]')30000

When creating scripts using the Test Settings interface, available commands show using intellisense as they are typed.   Only those commands which are supported by the Selenium RC language are allowed.  When importing using the Script importer, a parsing error will be thrown if unsupported commands are used in a warning similar to that shown below:

"The uploaded script contains one or more invalid commands"

Contact the Customer Success team at support@thousandeyes.com if you have any questions.

Significant portions of selenium command descriptions borrow from the seleniumhq.org website.  See http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/java/com/thoughtworks/selenium/DefaultSelenium.html for details.