AppNeta supports a large subset of “Selenese” commands as shown below. A full list of Selenese commands can be found here. Descriptions of AppNeta-specific commands can be found here.

Selenium actions

Selenium actions are commands that manipulate the state of the web app.

Each Selenium action can be used with or without the ‘AndWait’ suffix. So, for ‘addSelection’, as an example, the following are available:

  • addSelection
  • addSelectionAndWait

Selenium actions include:

  • addSelection
  • altKeyDown
  • altKeyUp
  • answerOnNextPrompt
  • break
  • captureEntirePageScreenshot
  • check
  • chooseCancelOnNextConfirmation
  • chooseOkOnNextConfirmation
  • click
  • clickAt
  • close
  • contextMenu
  • contextMenuAt
  • controlKeyDown
  • controlKeyUp
  • createCookie
  • deleteAllVisibleCookies
  • deleteCookie
  • doubleClick
  • doubleClickAt
  • focus
  • goBack
  • keyDown (see below)
  • keyPress (see below)
  • keyUp
  • metaKeyDown
  • metaKeyUp
  • mouseDown
  • mouseDownAt
  • mouseDownRight
  • mouseDownRightAt
  • mouseMove
  • mouseMoveAt
  • mouseOver
  • mouseUp
  • mouseUpAt
  • mouseUpRight
  • mouseUpRightAt
  • open (see below)
  • openAuthenticated (see below)
  • refresh
  • removeAllSelections
  • removeSelection
  • runScript
  • select
  • selectFrame
  • setCursorPosition
  • shiftKeyDown
  • shiftKeyUp
  • submit
  • type
  • uncheck
  • waitForCondition
  • waitForFrameToLoad
  • windowMaximize

The ‘AndWait’ suffix does not apply to the following commands as they do not result in browser navigation change:

  • echo
  • pause
  • setSpeed
  • setTimeout
  • setUserAgent
  • store
  • waitForPageToLoad

Selenium accessors/assertions

Selenium accessors are commands that examine the state of the web app and store the results in variables (e.g., storeAlert). Assertions verify the state is what is expected (e.g., assertAlert, verifyAlert, and waitForAlert).

Selenium accessors can have a ‘not’ prefix and/or one of the following prefixes: ‘store’, ‘assert’, ‘verify’, ‘waitFor’. So, for ‘alert’, as an example, the following are available:

  • storeAlert
  • storeNotAlert
  • assertAlert
  • assertNotAlert
  • verifyAlert
  • verifyNotAlert
  • waitForAlert
  • waitForNotAlert

Selenium accessors include:

  • alert
  • alertPresent
  • allButtons
  • allFields
  • allLinks
  • allWindowIds
  • allWindowNames
  • allWindowTitles
  • attribute
  • bodyText
  • checked
  • confirmation
  • confirmationPresent
  • cookie
  • cookieByName
  • cookiePresent
  • editable
  • elementHeight
  • elementIndex
  • elementPositionLeft
  • elementPositionTop
  • elementPresent
  • elementWidth
  • eval
  • htmlSource
  • location
  • prompt
  • promptPresent
  • script
  • selectOptions
  • selectedId
  • selectedIds
  • selectedIndex
  • selectedIndexes
  • selectedLabel
  • selectedLabels
  • selectedValue
  • selectedValues
  • somethingSelected
  • speed
  • text
  • title
  • value
  • visible
  • xpathCount

Key representations for keyDown and keyPress

The keyDown and keyPress commands take a key representation as an argument. The key representations can be found here. It is important to note that the representation shown on this page is not what is used as an argument to these commands. For example, the ENTER key is represented as u’\ue007’ but must be specified as \e007 in Selenium. When used in the script editor, it looks as follows:

keyDown-example.png

AppNeta-specific Selenium commands

blacklistUrl( url )

(supported in Chrome only)
Stops the browser from requesting content from the specified url. This is typically used so that traffic generated by Experience monitoring scripts does not affect marketing statistics. In addition, it ignores the load time of secondary resources (for example, advertising) that do not impact the ability of a user to interact with a given page.

Arguments:

  • url - The URL to be blacklisted. It can be an exact URL or a pattern as specified here. Badly formatted patterns are ignored. Blacklisted URLs specified with this command are in addition to the list of system-defined blacklisted URLs. The user-defined blacklist is reset at the start of each new test.

clickIfVisible( locator )

(supported in Chrome only)
Clicks on a link, button, checkbox, or radio button only if it is present and visible. If the element is not present and visible, script execution continues.

Arguments:

  • locator - The element locator.

open( url )

Opens the URL specified.

Arguments:

  • url - the URL to open

Note: When creating or editing a Selenium script, the HTTP Authentication field has prompts for Username and Password. The values in these fields are used by the open command (if prompted for by the target) with one of the supported authentication methods.

openAuthenticated( url, username:password )

Provides a convenient way to access a site that uses basic access authentication using the credentials provided. Be aware that, if a redirect occurs after login, credentials will be lost. Because of this, we recommend using the open command.

Arguments:

  • url - the URL to open
  • username - the user name to login with
  • password - the password to login with

selectActiveWindow( )

(supported in Chrome only)
Switches script execution to a newly spawned tab.

setUserAgent( useragent )

(supported in Chrome only)
Provides the ability to specify the user agent you want your script to identify as. This is useful when communicating with applications that support a number of different user agents. By default, the @linux User Agent Request Header (see below) is sent.

Arguments:

useragent - The user agent you want to be active. You can use one of the pre-defined values or specify a custom string directly. Pre-defined values and the associated User Agent Request Headers generated include:

useragent User Agent Request Header
@default User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36
@linux User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36
@macos User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36
@mobile User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36
@windows User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36

An example custom string and the User Agent Request Header generated:

useragent User Agent Request Header
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0) User-Agent:Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)