What's New
Product Documentation

Transactions (Classic) - Supported Selenium Commands

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, see the Transaction Scripting Guide.

Web Transaction tests in ThousandEyes allow 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.

  • Write a script using Selenium, export it to a file, and import that file into ThousandEyes.

  • Manually write 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.

ThousandEyes 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, see the SeleniumHQ website.

Command

Description

Required Parameters

addSelection

Add 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 value

target, value

altKeyDown

Presses the 'alt' key down and holds until an altKeyUp command is sent, or a new page is loaded

-

altKeyUp

Releases the 'alt' key

-

assignId

Temporarily 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 id

target, value

check

Check a toggle-button (checkbox/radio). Specify the element as the target

target

click

Clicks on a link, button, checkbox or radio button. Specify the element as the target.

target

clickAt

Clicks 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

chooseCancelOnNextConfirmation

By 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.

-

chooseOkOnNextConfirmation

Undo the effect of calling chooseCancelOnNextConfirmation.

-

controlKeyDown

Presses the 'control' key down and holds until a controlKeyUp command is sent, or a new page is loaded

-

controlKeyUp

Releases the 'control' key

-

createCookie

Create 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

dragAndDrop

Drags an element a certain distance and then drops it. Specify the element as the target, and the coordinates as the value.

target, value

dynamicType

Similar 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

fireEvent

Explicitly simulate an event, to trigger the corresponding "onevent" handler. Specify the event as the target, and parameters as the value.

target, value

focus

Move the focus to the specified element. Specify the element as the target.

target

keyDown

Simulates 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

keyPress

Simulates 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

keyUp

Releases a key. Specify the same target and value as the keyDown command.

target, value

metaKeyDown

Presses the appropriate OS meta key (Windows Key / Command Key). Holds until a metaKeyUp command is sent, or a new page is loaded

-

metaKeyUp

Releases the meta key

-

mouseOver

Simulates a user moving the mouse pointer over the target with the mouse.

target

mouseOut

Simulates a user moving the mouse pointer away from the specified element.

target

mouseDown

Simulates a user pressing the mouse button (without releasing it yet) on the specified element. Specify the element as the target.

target

mouseDownAt

Simulates 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

mouseMove

Simulates a user pressing the mouse button (without releasing it yet) on the specified element. Specify the element as the target.

target

mouseMoveAt

Simulates 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

mouseUp

Simulates 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

mouseUpAt

Simulates 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

open

Opens 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

refresh

Simulates the user clicking the "Refresh" button on their browser.

-

removeAllSelections

Unselects all of the selected options in a multi-select element. Specify the element as the target.

target

removeSelection

Remove 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

runScript

Creates 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

select

Select 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

selectFrame

Selects 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

selectWindow

Selects 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.

-

setTimeout

Specifies 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

shiftKeyDown

Presses the 'shift' key down and holds until a shiftKeyUp command is sent, or a new page is loaded

-

shiftKeyUp

Releases the 'shift' key

-

sleep

pause 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

submit

Submits the form, specified as the target

target

type

Sets 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

typeKeys

Simulates 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

uncheck

Uncheck a toggle-button (checkbox/radio). Specify the element as the target

target

waitForCondition

Runs 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

waitForDownload

Waits 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

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 expression

Description

Parameters

isChecked

Gets whether a toggle-button (checkbox/radio) is checked

element

isConfirmationPresent

Has confirm() been called?

-

isElementPresent

Verifies that the specified element is somewhere on the page.

element

isOrdered

Check if these two elements have same parent and are ordered siblings in the DOM.

element1, element2

isPromptPresent

Has a prompt occurred?

-

isSomethingSelected

Determines whether some option in a drop-down menu is selected.

element

isTextPresent

Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.

textPattern

isVisible

Determines 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:

Step

Name

Command

Target

Value

0

Open page

open

/

‚Äč

1

Check for non-existent element

waitForCondition

!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 Engineering team at [email protected] if you have any questions.

Significant portions of Selenium command descriptions borrow from the selenium.dev website. See https://www.selenium.dev/ for details.