Web Commands
List of all web commands:
Commands: | ||
---|---|---|
click | scroll | dragAndDrop |
input | javascript | repeat |
dropDown | include | hovers |
navigate | wait | image |
assert | clear | switchToFrame |
scrollTo | tab | hotKey |
repeat | doubleClick |
<click>
Description: command to perform click
Required parameters:
- comment
- locator – locator, where the click will be performed
Optional parameters:
- method – click method (selenium or javascript)
- highlight – boolean, where 'true' means imputed text will be highlighted with a grey body and 3px solid yellow border
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<click comment="Click on 'Sign In' button"
locator="login.signIn"/>
<input>
Description: command to enter a value into the specific field (requires a locator of this field)
Required parameters:
- comment
- locator of the field into which a value will be inputted
- value – non-empty string
Optional parameters:
- highlight – boolean, where 'true' means imputed text will be highlighted with a grey body and 3px solid yellow border
- condition - condition according to which this test step will or won't be executed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<input comment="Input first name"
locator="ownerRegistration.firstName" - locator of the UI Element for inputting
value="Mario"/> - value which you want to input
Also, using the <input>
command, we have the opportunity to insert an image file of the desired format (for example, add an account photo).
To implement this function, the desired image must be located in the same folder as your test scenario, for example, in a folder called scenario.
<input comment="Add profile photo"
locator="userPhoto.addProfilePhotoButton" - selected element of interaction
value="file:Firmino.jpg"/> - Inside of `value` we’re indicating that we want to insert a file using 'file:' , after that we enter the name of the file (which is located in the scenario folder)
i.e. Firmino.jpg.
<dropDown>
Description: command to select from the drop-down list menu
Option to choose: oneValue or allValues;
Required parameters:
- comment
- locator of the dropDown element
oneValue:
- type – select or deselect
- by – options how to select: a)Text; b)Value; c)Index
- value – non-empty string value that represents one of the “by” selector values
allValues:
- type – deselect
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<dropDown comment="Deselect all countries" locator="registration.country">
<allValues type="deselect"/>
</dropDown>
<navigate>
Description: command to perform navigation
Required parameters:
- comment
- command (back, reload or to)
Optional param:
- path – if the command “to” string path should be provided
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<navigate comment="Go to register account page"
command="to"
path="/registerAccount"/> - path URL
<assert>
Description: command to check whether the data is entered or the element is displayed on the page
There are seven types:
- attribute - assert by any UI element's attribute
- title - assert by title of the page
- equal - equality of two or more values is checked
- notEqual - the inequality of two or more values is checked
- checked - verifies if checkboxes or radio buttons are selected
- present - checks if an element exists on the page
- alert - verifies the presence and content of alert messages
Required attribute for each type:
- comment
Optional attribute for each type :
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
- negative - when 'true' is selected, it is checked that the expected and actual content do not match (default value - 'false')
Required parameters according to the type:
attribute
- comment
- locator - locator of the UI element
- name - name of attribute
- content - content of the attribute
title
- comment
- content - title of the page
- comment
equal
- comment
- content - values for comparison (The minimum number must be two)
- comment
notEqual
- comment
- content - values for comparison (The minimum number must be two)
- comment
alert
- _
comment
_
- text - alert text for comparison
- _
comment
_
checked
- comment
- locator - locator of the UI element
- comment
present
- comment
- locator - locator of the UI element
- comment
<assert comment="Check that element is present on the page">
<attribute comment="Assert 'password' field"
name="name" - name of attribute for asserting (id, name, outerHTML, innerHTML, etc)
locator="registration.inputPassword"> - locator of the element to assert
<content>password</content> - content of the attribute
</attribute>
</assert>
You can assert several elements within one <assert>:
<assert comment="Test for Assert with sub-commands - notEqual, equal, attribute, title">
<attribute comment="Assert 'password' field" name="name" locator="registration.inputPassword">
<content>password</content>
</attribute>
<title comment="Check whether title of the page is correct">
<content>Default store | Login</content>
</title>
<notEqual comment="Assert for check that 3 different contents is not equal">
<content>one</content>
<content>1</content>
<content>{{ONE}}</content>
</notEqual>
<equal comment="Assert for check that two contents is equal">
<content>one</content>
<content>{{one}}</content>
</equal>
<assert comment="Asserting for present and Not present element on the page">
<present comment="Check that element on page is present" locator="forms.save"/>
<present comment="Check that element on page is NOT present" locator=".//img[@alt= 'Sunset in the mountains']" locatorStrategy="xpath" negative="true"/>
</assert>
<assert comment="Asserting on page">
<checked comment="Check that checkbox is NOT chosen" locator="uiElements.checkbox" negative="true"/>
</assert>
<assert comment="Asserting on page">
<checked comment="Check that checkbox is chosen" locator="uiElements.checkbox" negative="false"/>
</assert>
<assert comment="Asserting on page">
<alert comment="Check that alert equal expected content">
<text>Alert!</text>
</alert>
<alert comment="Check that alert not equal expected content" negative="true">
<text>Alert</text>
</alert>
</assert>
</assert>
<scrollTo>
Description: command to perform scroll-to-element action
Required parameters:
- comment
- locator – locator of the element to which scroll to action will be performed
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<scrollTo comment="Scroll to element"
locator="footer.registerButton"/> - locator of the element you want to scroll to
<scroll>
Description: command to perform scroll action
Required parameters:
- comment
- type – a type of the scroll
- page - scrolling the whole page
- inner - scrolling inside an element on the page
- value – a value of the scroll
Optional parameters:
- direction – up or down. Down is default
- measure – how value is measured (pixels or percent). Pixels are default.
- locator – if a type is “inner”, the locator for an element is needed to be provided
- condition - condition according to which this test step will or won't be executed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<scroll comment="Scroll Down to 90 per cent"
value="90"
direction="down"
measure="percent"
type="page"/>
<javascript>
Description: command to execute user's javascript commands
Required parameters:
- comment
- file – file with js commands
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<javascript comment="Your comment"
file="function.js"/>
<include>
Description: command that allows you to run a ‘scenario inside a scenario’ (often used to bundle different scenarios)
Required parameters:
- comment
- scenario - path to the scenario you need to launch. Since all scenarios must be stored in 'scenarios' folder, in this parameter you need specify path to your scenario from 'scenario' folder
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
<include comment="Add scenario for login to the system"
scenario="/nameOfScenarioFolderWithSlash"/> - a path to the scenario you need to launch
<wait>
Description: command that pauses the passage of the scenario to perform a certain function that requires a wait. The scenario continues running in the usual way after this command
Required parameters:
- comment
- time – integer value
Optional parameters:
clickable - pauses execution until a specific element on a webpage or interface becomes clickable, or as much as was specified in the time field, but in the case when the element was not defined as a clickable for a specified time, wait step will fail. The presence of the specified element in the DOM of the page is mandatory, otherwise the element will be determined as not found
- comment
- locator
visible - pauses until a specific element becomes visible on a webpage or interface, which means that the element is in the DOM of the page, but it is defined as invisible (for example: an element that must be hovered over to see it
style="display: none;"
)- comment
- locator
unit – seconds or milliseconds. Seconds are used as default if the unit param is not used
condition - condition according to which this test step will or won't be executed
threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<wait comment="Wait for 10seconds or less until element become clickable" time="10" threshold="1000">
<clickable comment="Wait for 10 or less seconds until element become clickable" locator="login.signIn"/>
</wait>
<wait comment="Wait 1 second" time="1000" unit="millis"/>
<wait comment="Wait 10 seconds" time="10000" unit="millis" threshold="500">
<visible comment="Wait for 10 or less seconds until element become visible" locator="login.mail"/>
</wait>
<clear>
Description: command to clear the data that has been entered in the specific field (requires a locator of this field)
Required parameters:
- comment
- locator of the field which must be cleared
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
- highlight - boolean, where 'true' means cleared text will be highlighted with a grey body and 3px solid yellow border
<clear comment="Clear password"
locator="demoNative.clear"
highlight="true"/>
<tab>
Description: command to perform operations with tabs
There are three types:
- close
- switch
- open
Required attribute for each type:
- comment
Optional attribute for each type :
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
Required parameters according to the type:
close
- index - index of tab that should be closed. (If you do not specify the index, it will be close current tab)
switch
- index - switch to tab with selected index.
open
- url - open a tab via specified URL
<tab comment="Switch to second tab">
<switch index="2"/>
</tab>
<tab comment="Close tab with index 2">
<close index="2"/>
</tab>
<tab comment="Open a tab via url">
<open url="http://URL"/>
</tab>
<tab comment="Close current tab">
<close/>
</tab>
<dragAndDrop>
Description: command that allows you to check by clicking on an object and dragging it to another location
Required parameters:
- comment
- toLocator - locator id of the place, where you need to drop an element
- fromLocator - locator id of the element which you need to drag and drop
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- fileName - if you need to upload the file, you can put file name in this parameter, file must be in the same path as scenario
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
fromLocator
<dragAndDrop comment="Drag and drop action"
toLocator="nativeDrag.dragFirst">
<fromLocator>nativeDrag.dropSecond</fromLocator>
</dragAndDrop>
It is also possible to upload any file to the site due to this command.
<dragAndDrop comment="Add image with dragAndDrop example" toLocator="dragAndDrop.image">
<fileName>/home/user/image.jpg</fileName>
</dragAndDrop>
<repeat>
Description: command that allows you to repeat any action used in the commands
Required parameters:
- comment
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
- times - is to set the number of repeating (not used with variations)
- variations - attribute for the variations file (not used with times)
<web comment="Start web scripts">
<repeat comment="Check the ability to run variations in repeat" variations="variations_2.csv">
<click comment="Click on drop down filed" locator="uiElements.dropDownField"/>
<click comment="Click on first options" locator="uiElements.firstOptions"/>
<wait comment="Wait for 1 second" time="1"/>
</repeat>
</web>
Inside the web <repeat> command you can use any web commands.
<hover>
Description: command to perform hover action
Required parameters:
- comment
- locator of the UI element you want to perform hover action with
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<hover comment="Open drop down 'Novels' tab" locator="locator.novels"/>
<image>
Description: command to take a screenshot and compare it with the expected result
There are three types:
- fullScreen (compare a full screenshot)
- picture (compare image file by locator)
- part (compare a part screenshot of the specific element by locator)
Required attribute for each type:
- comment
- file - expected image file to compare with screenshot
Optional attribute for each type :
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- highlightDifference - parameter that turns on/off highlighting of difference
Required parameters according to the type:
fullScreen
- percentage - the percentage of accuracy of the screenshot comparison, where 100% is the comparison of the entire screenshot (if not indicated it will be considered as 100)
- exclude - excluding element by locator from screenshot comparison
- locator - locator of the specific element
picture
- locator - locator of the specific image element
- attribute - image source attribute name. DEFAULT=src
part
- locator - locator of the specific element what to compare
- percentage - the percentage of accuracy of the screenshot comparison, where 100% is the comparison of the entire screenshot (if not indicated it will be considered as 100)

when you configure the exclude and turn on highlightDifference="true", in the case that the image does not match, the excluded zone will be highlighted in orange, and the area that has not yet matched will be highlighted in red (on the screen above)
NOTE:
Image comparison is a test feature. On multiple devices, the same window can have different dimensions so the comparison will be failed. Comparison of specific elements works fine due to our tests.
<image comment="Compare full screen with percentage less then 100" file="compare1.png">
<fullScreen percentage="88"/>
</image>
<image comment="Compare full screen" file="compare2.png" highlightDifference="true">
<fullScreen/>
</image>
<image comment="Compare full screen with exclude" file="compare3.png">
<fullScreen>
<exclude locator="forms.username"/>
</fullScreen>
</image>
<image comment="Compare a part of screen with percentage less then 100" file="compare4.png">
<part locator="forms.form" percentage="99"/>
</image>
Also, using the command, you can check the display of the image of some element:
<image comment="Compare image from the page"
file="compare2.png"> - expected picture
<picture locator="image.compare"/> - locator ID of the picture to be compared
</image>
<switchToFrame>
The command that allows you to work in another frame
After closing the tag, you can continue to use locators inside the page.
<switchToFrame comment="Open api frame on the site"
locator="frame.page">
<input comment="Add email the page"
locator="frame.email"
value="test@gmail.com"/>
<clear comment="Clear email"
locator="frame.clear"
highlight="true"/>
<click comment="Click button"
locator="frame.button"/>
</switchToFrame>
<hotKey>
The command responsible for individual keys or their combinations that are on the keyboard
There is a division of commands without locators and with locators.
Tags are used with locators
- copy
- cut
- paste
- highlight
<hotKey comment="Paste the password">
<paste comment="Paste the password"
locator="hotKey.password"/>
</hotKey>
And the others without using a locator, but using times - the number of executions (default value - 1) :
- tab
- space
- backspace
- escape
- enter
<hotKey comment="click enter">
<enter comment="click enter" times="2"/>
</hotKey>
The WEB tag are the main interpreter containing the set of all tags for interacting with the user interface, which will be described below. You can use third-party link navigation.
Tag's usage example:
<web comment="Start web scripts">
<navigate command="to" comment="Go to base page"
path="/shop/"/>
<wait comment="Wait for visualize a click"
time="2" unit="seconds"/>
<click comment="Click on the 'Shopizer' website link which opens in a new window"
locator="shopizer.webSiteShopizer"/>
</web>
<doubleClick>
Description: command to perform double click
Required parameters:
- locator – locator, where the click will be performed
- comment
Optional parameters:
- highlight – boolean, where 'true' means imputed text will be highlighted with a grey body and 3px solid yellow border
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds) , if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<doubleClick comment="Double click on button" locator="login.button"/>