Element actions
I <click|right click|double click> <element>
Clicks a web element.
I <click|right click|double click> <element>
Where
<click|right click|double click>is one of:<element>is the name of the element to click
Example
Given the start button can be located by name "commit"
When I navigate to "https://challengers.flood.io/start"
And I click the start button
I <click|right click|double click> <element> of <context>
Clicks a context sensitive web element.
I <click|right click|double click> <element> of <context>
Where
<click|right click|double click>is one of:<element>is the name of the element to click<context>is the context element to focus into (in order to click<element>)
Example
Given the menu item can be located by id "menu-item-id"
And the action button can be located by id "action-button-id"
When I click the action button of the menu item
I <modifierKeys> <click|right click|double click> <element>
Holds down the specified modifier keys and clicks an element.
I <modifierKeys> <click|right click|double click> <element>
Where
<modifierKeys>is a+separated list of modifier keys to hold down during the click- Modifier keys can be single keyboard characters or any supported key constants
- Node: Keys behave differently on different platforms
<click|right click|double click>is one of:clickto click the elementright clickto right click the elementdouble clickto double click the element, since v2.12.0
<element>is the name of the element to click
Example
Given the button can be located by tag "button"
And I COMMAND+SHIFT click the button
I <check|uncheck|tick|untick> <checkbox>
Ticks or unticks a checkbox element.
I <check|uncheck|tick|untick> <checkbox>
Where
<check|uncheck|tick|untick>is one of:<checkbox>is the name of the checkbox element
Example
Given the email checkbox can be located by id "checkbox1"
When I navigate to "https://automationintesting.com/selenium/testpage"
And I tick the email checkbox
I move to <element>
Moves to a web element and gives it the focus.
I move to <element>
I <enter|type> "<text>" in <element>
Enters or types text into a web element.
I <enter|type> "<text>" in <element>
Where
<enter|type>is one of:enterto send the text to the field followed by the enter keytypeto send the text to the field only (without trailing enter key)
<text>is the text to send to the field<element>is the name of the field to send the text to
Example
Given the todo field can be located by class "new-todo"
When I navigate to "https://todomvc.com/examples/react/dist"
And I enter "Walk the dog" in the todo field
I <enter|type> <textRef> in <element>
Enters or types a text reference value into a web element.
I <enter|type> <textRef> in <element>
Where
<enter|type>is one of:enterto send the text to the field followed by the enter keytypeto send the text to the field only (without trailing enter key)
<textRef>is the name of the binding containing the text to send to the field- Can be the name of any binding that contains or resolves to a text value, including a web element in which case the text in the element will be dynamically retrieved and used.
<element>is the name of the field to send the text to
Example
Given the todo field can be located by class "new-todo"
And my item is "Walk the dog"
When I navigate to "https://todomvc.com/examples/react/dist"
And I enter my item in the todo field
I append "<text>" to <element>
Appends the given text to the current text value of an element.
I append "<text>" to <element>
I append <textRef> to <element>
Appends the given referenced text to the current text value of an element.
I append <textRef> to <element>
Where
<textRef>is the name of the binding containing the text to append to the element- Can be the name of any binding that contains or resolves to a text value, including a web element in which case the text in the element will be dynamically retrieved and used.
<element>is name of the element to append the text to
Example
Given the search field can be located by name "q"
And my additional search term is " automation"
When I navigate to "https://google.com"
And I type "Gwen" in the search field
And I append my additional search term to the search field
I press <enter|tab> in <element>
Send the enter or tab key to a web element.
I press <enter|tab> in <element>
Where
<enter|tab>is one of:enterto send the enter keytabto send the tab key
<element>is the name of the element to send the key to
Example
Given the surname field can be located by id "surname"
When I navigate to "https://automationintesting.com/selenium/testpage"
And I press tab in the surname field
I send "<keys>" to <element>
Sends a sequence of keys to an element (for emulating keyboard shortcuts).
I send "<keys>" to <element>
Where
<keys>is a,or+(since v2.53.0) separated list of keys to send.- Keys can be single keyboard characters or any supported key constants
- Note: Keys behave differently on different platforms
<element>is the name of the element to send the keys to
Example
Given the search field can be located by name "q"
When I navigate to "https://google.com"
And I type "automation" in the search field
And I send "COMMAND+A" to the search field
And I send "COMMAND+C" to the search field
And I clear the search field
And I send "COMMAND+V" to the search field
And I send "ARROW_DOWN" to the search field
And I press enter in the search field
I insert a new line in <textarea>
Inserts a new line into a textarea element.
I insert a new line in <textarea>
Where
<textarea>is the name of the textarea element to insert the new line into
Example
Given the more field can be located by tag "textarea"
When I navigate to "https://automationintesting.com/selenium/testpage"
And I type "Hi," in the more field
And I insert a new line in the more field
And I type "I like Gwen." in the more field
And I insert a new line in the more field
And I type "Bye!" in the more field
Then the more field should contain
"""
Hi,
I like Gwen.
Bye!
"""