These are the available Element functions in the Selenium script fixture:
|
Click Element |
Description: |
Click a specific element |
In: |
element locator |
Out: |
whether clicking succeeded (true/false) |
Example(s): |
| click element | PartialLinkText:Standards View | | click element | XPath://a[contains(.,'FAQ')] | | click element | id:mp1_0_0_ICON | |
|
Click Element If Visible |
Description: |
Click a specific element if it is visible, ignore if not |
In: |
element locator |
Out: |
true if successful click, null if not |
Example(s): |
| click element | CssSelector: .optanon-button-allow | if visible | |
|
Deselect Option In Element |
Description: |
Deselect an option in a select element |
In: |
option to deselect, locator true |
Example(s): |
| Deselect option | text:option 1 | in element | multiselect | | Deselect option | value:option1 | in element | multiselect | | Deselect option | index:2 | in element | multiselect | |
Note(s): |
Format for option: as locator, with methods text , value or index (0 based) |
|
Drag Element And Drop At |
Description: |
Drag an element to an X,Y location. |
In: |
element locators for the element dragged, drop location (x, y coordinates in pixels) |
Out: |
success? (true/false) |
Example(s): |
| drag element | boxA | and drop at | 150, 100 | |
Note: |
only works on mobile platforms |
|
Drag Element And Drop On Element [In Driver] |
Description: |
Drag an element and drop it onto another element, With In Driver: drop onto an element in another driver. |
In: |
element locators for the element dragged and the element dropped onto, [driver ID] |
Out: |
whether the close succeeded (true/false) |
Example(s): |
| drag element | boxA | and drop on element | container1 | |
|
Move To Element |
Description: |
Move the cursor to a certain element |
In: |
element locator |
Out: |
whether or not the operation was successful (true/false) |
Example(s): |
| move to element | CssSelector : div.div1 | |
|
Right Click Element |
Description: |
Right click an element (a.k.a. context click) |
In: |
element locator |
Out: |
whether the close succeeded (true/false) |
Example(s): |
| Right click element | id:text1 | |
|
Scroll To Element |
Description: |
Scroll to an element. Intended for mobile devices. Ignores direction with browsers (using Move To Element instead) |
In: |
Up /Down /Left /Right /FromTop , Element locator |
Out: |
success? (true/false) |
Example(s): |
| Scroll | Down | To Element | id:TestBox | |
|
Select Option In Element |
Description: |
Select an option in a select element |
In: |
option to select, locator |
Out: |
true |
Example(s): |
| Select option | text:option 1 | in element | multiselect | | Select option | value:option1 | in element | multiselect | | Select option | index:2 | in element | multiselect | |
Note(s): |
Format for option: as locator, with methods text , value or index (0 based integer) |
|
Send Keys [To Element][If Type Is] |
Description: |
Emulate typing keys into an element, or to the active element if To Element not specified. |
In: |
keys to send [, element locator [, type attribute value] ] |
Out: |
true if successful, false if not. If If Type Is is used, true is returned if the type is not equal to the specified type. |
Example(s): |
| send keys | ^ac^{DEL}text | to element | myText | | send keys | 2014-02 | to element | myMonth | if type is | text | | send keys | 2{TAB}2014 | to element | myMonth | if type is | month | |
Note(s): |
See References - Keys for a description of the format for the keys to send.
If Type Is extension is intended to be used for input elements that are potentially unknown by browsers (e.g. date, time) and for which a fall back to basic text elements may be done. |
|
Set Attribute Of Element To |
Description: |
Set an attribute value of a certain element |
In: |
attribute name, element locator, attribute value |
Out: |
true if successful, false if not |
Example(s): |
| set attribute | src | of element | myImage | to | home.jpg | |
Note(s): |
Uses JavaScript as native Selenium doesn’t support this (since you would normally not be able to do this via the web interface). |
|
Set Element Checked |
Description: |
Check an element (i.e. select it if it was not already selected) |
In: |
- |
Out: |
success? (true/false) |
Example(s): |
| ensure | set element | name:checkbox1 | checked | |
|
Set Element To |
Description: |
Sets the value of a certain element (via SendKeys) |
In: |
element locator, new value |
Out: |
whether or not the operation succeeded (true/false) |
Example(s): |
| ensure | set element | name:q | to | FitNesse | |
|
Set Element Unchecked |
Description: |
Uncheck an element (i.e. deselect it if it was not already selected) |
In: |
- |
Out: |
success? (true/false) |
Example(s): |
| ensure | set element | name:checkbox1 | unchecked | |
|
Set Text In Element To |
Description: |
Set the innerHTML of a certain element (via JavaScript). Overwrites all content or other elements that may be in there. |
In: |
element locator, text to set |
Out: |
true if succeeded, false if not |
Example(s): |
| set text in element | tagname:div | to | New Text | |
|
Submit Element |
Description: |
Submit a form via an element |
In: |
element locator |
Out: |
true if successful, false if not |
Example(s): |
| submit | element | name:file | |
|
Tap Element |
Description: |
Single tap an element (mobile only) |
In: |
frame locator |
Out: |
success? (true/false) |
Example(s): |
| tap element | id:button | |
|
Upload File In Element |
Description: |
Upload a file into an element suited for that. |
In: |
file name, element locator |
Out: |
true if succeeded, false if not. |
Example(s): |
| upload file | uploadTestFile.txt | in element | name:fileToUpload
|
|
All Options Of Element By |
Description: |
Return a list of all options in a select element |
In: |
element locator, method (text , value ) |
Out: |
list of options |
Example(s): |
| check | all options of element | dropdown | by\ | text | [item 1, item 2] | | check | all options of element | dropdown | by | value | [item1, item2] | |
|
Attribute Of Element |
Description: |
Return an attribute value of a certain element |
In: |
attribute name, element locator |
Out: |
attribute value |
Example(s): |
| show | attribute | href | of element | CssSelector : a.link | |
|
Css Property Of Element |
Description: |
Return a CSS property of a certain element |
In: |
CSS property, element locator |
Out: |
CSS property value |
Example(s): |
| check | Css Property | color | of element | status | | |
|
Double Click Element |
Description: |
Double click an element |
In: |
element locator |
Out: |
whether the close succeeded (true/false) |
Example(s): |
| double click element | id:paragraph | |
|
Element Exists |
Description: |
Returns whether a certain element exists on the page |
In: |
Element Locator |
Out: |
whether the element is present (true/false) |
Example(s): |
| element | firstName | exists | |
|
Element Has Attribute |
Description: |
Returns whether a certain element has the specified attribute |
In: |
Element Locator, attribute name |
Out: |
whether the element is has the attribute |
Example(s): |
| element | checkbox | has attribute | checked | |
|
Element Is Checked |
Description: |
Returns whether the element is selected/checked |
In: |
Element Locator |
Out: |
whether the element is checked ( true/ false) |
Example(s): |
| ensure | element | submitButton | is checked | |
|
Element Is Clickable |
Description: |
Returns whether a certain element can be clicked (i.e. is enabled and displayed) |
In: |
Element Locator |
Out: |
whether the element can be clicked ( true/ false) |
Example(s): |
| ensure | element | submitButton | is clickable | |
|
Element Is Visible |
Description: |
Returns whether a certain element is visible on the page |
In: |
Element Locator |
Out: |
whether the element is visible ( true/ false) |
Example(s): |
| ensure | element | popupDialog | is visible | |
|
Selected Option In Element [By] |
Description: |
Returns the selected option for single-select elements, or the first selected option for multi-select elements |
In: |
element locator [, method] |
Out: |
the selected element (null if nothing selected) |
Example(s): |
| check | selected option in element | single-select | item | |
Note(s): |
Method can be text or value , to return visible text or value, respectively. Default is text. |
|
Selected Options In Element [By] |
Description: |
Returns all selected options for select elements |
In: |
element locator [, method] |
Out: |
a list of selected elements (empty list if nothing selected) |
Example(s): |
| check | selected options in element | multi-select | [item 1, item 2] | | check | selected options of element | multi-select | by | value | [item1, item2] | |
Note(s): |
Method can be text or value , to return visible text or value, respectively. Default is text. |
|
Text In Element |
Description: |
Return the text of a certain element |
In: |
element locator |
Out: |
text value of the element |
Example(s): |
| show | text in element | CssSelector : div.div1 b | |
|
Text In Element Matches |
Description: |
Check if the text in a certain element matches a regular expression |
In: |
element locator, regex pattern |
Out: |
true if found, false if not |
Example(s): |
| ensure | text in element | name:title | matches | Dashboard | |
|
Wait For Element |
Description: |
Waits for an element to be present on the page |
In: |
element locator |
Out: |
whether or not the text was found (true/false) |
Example(s): |
| Wait For Element | CssSelector : #searchSource | |
|
Wait Until Element Does Not Exist |
Description: |
Wait until an element does not exist on the page (e.g. got deleted) |
In: |
element locator |
Out: |
true if not existing before the timeout, false if keeps existing. |
Example(s): |
| ensure | wait until element | id:popup | does not exist | |
|
Wait Until Element Is Clickable |
Description: |
Wait until an element is clickable on the page |
In: |
element locator |
Out: |
true if found before the timeout, false if not. |
Example(s): |
| ensure | wait until element | tagname: button | is clickable | |
|
Wait Until Element Is Invisible |
Description: |
Wait until an element is invisible on the page |
In: |
element locator |
Out: |
true if it was invisible before the timeout, false if not. |
Example(s): |
| wait until element | myDialog | is invisible | |
|
Wait Until Element Is Not Clickable |
Description: |
Wait until an element is not clickable on the page |
In: |
element locator |
Out: |
true if not clickable before the timeout, false if clickable. |
Example(s): |
| ensure | wait until element | tagname: button | is clickable | |
|
Wait Until Element Is Visible |
Description: |
Wait until an element is visible on the page |
In: |
element locator |
Out: |
true if it was visible before the timeout, false if not. |
Example(s): |
| wait until element | myDialog | is visible | |
|
Wait Until Text In Element Matches |
Description: |
Wait until the text in an element matches the regular expression provided |
In: |
element locator, regular expression to match |
Out: |
whether a match was found before the timeout (true/false) |
Example(s): |
| wait until element | myDialog | is visible | |