Verisoft Wiki

The Web Dictionary provides ready-made Cucumber steps for automating web UI interactions (navigation, clicking, typing, verifying elements) with Selenium WebDriver, for both single-driver and multi-driver scenarios.

Available since version: 4.0.7

What changed in 4.0.8

New sentences: click a button only if it is there, click through JavaScript, reload the page, tick or untick a checkbox, select a radio button, scroll until an element is visible, wait for a single slow element, save a field's value for later steps, and four new checks — an element's text, whether an element is enabled, whether a checkbox or radio button is selected, and whether a field is empty.

Removed sentences. Replace them in existing feature files:

Removed Use instead
user sees text {string} on element {string} user sees element {string} contains text {string} — note that the element now comes first
user sees button {string} user sees element {string} is on page
user sees field {string} user sees element {string} is on page
user sees page subtitle {string} user sees element {string} contains text {string}
user sees error message of type {string} with text {string} user sees element {string} contains text {string}

Given:

Key Sentence Type Description Example
user switches to driver {string} Setup Switch the active driver, used only in multi-driver scenarios Givenuser switches to driver "Chrome"

When:

Key Sentence Type Description Example
user navigates to page {string} Action Navigate to a URL Whenuser navigates to page "https://example.com"
user refreshes the page Action Reload the current page and wait for it to finish loading Whenuser refreshes the page
user clicks button {string} Action Click a button Whenuser clicks button "loginButton"
user clicks button {string} if it exists Action Click the button only if it is on screen. If it isn't, the step is skipped and the test carries on — for things that are not always there, such as a cookie banner. Waits the full configured timeout before giving up Whenuser clicks button "cookieBanner" if it exists
user clicks button {string} using JavaScript Action Click through JavaScript instead of a real mouse click. Use it only when a normal click cannot reach the element, for example when something covers it Whenuser clicks button "submitButton" using JavaScript
user enters value {string} in field {string} Action Type a value into a field Whenuser enters value "john" in field "usernameField"
user deletes value in field {string} Action Clear a field's value Whenuser deletes value in field "usernameField"
user selects date {string} in field {string} Action Enter a date into a date field. Accepts a fixed date, or a dynamic one such as "today plus 5 days" — see Dynamic values in any sentence on the parent page Whenuser selects date "15/10/2025" in field "dateField"
Whenuser selects date "{{$dd/MM/yyyy+5d}}" in field "dateField"
user {checkAction} checkbox {string} Action Tick or untick a checkbox. {checkAction} is checks or unchecks — written without quotes. It clicks only if the checkbox isn't already in that state, so the sentence always leaves it the way you asked Whenuser checks checkbox "termsCheckbox"
Whenuser unchecks checkbox "newsletterCheckbox"
user checks radio button {string} Action Select a radio button. It clicks only if it isn't already selected. There is no sentence for clearing one — a radio button is cleared only by selecting another one in its group Whenuser checks radio button "expressShipping"
user selects option {string} in field {string} Action Open a dropdown/list field and click the option matching the given value. If the value is empty (""), the first available option is selected instead Whenuser selects option "male" in field "genderDropdown"
user scroll {direction} Action Scroll the page. {direction} is one of: up, down, left, right — written without quotes Whenuser scroll down
user scrolls {direction} to element {string} Action Scroll repeatedly in {direction} until the element is visible, up to 10 attempts. Fails if it still isn't visible Whenuser scrolls down to element "submitButton"
user waits for {string} element to be visible within {string} seconds Action Wait up to the given number of seconds for one element, instead of the project-wide timeout. Use it for an element that is slower than the rest Whenuser waits for "reportTable" element to be visible within "60" seconds
user logs in with username {string} and password {string} Action Quick login shortcut. Requires locators named usernameField, passwordField and loginButton Whenuser logs in with username "john" and password "1234"

Then:

Key Sentence Type Description Example
user sees page title {string} Assertion Verify the browser page title contains the given text Thenuser sees page title "Dashboard"
user sees element {string} {onPageState} Assertion Verify an element's presence. {onPageState} is is on page or is not on page — written without quotes Thenuser sees element "errorMsg" is not on page
user sees element {string} {compareType} text {string} Assertion Compare an element's text with the given text. {compareType} is one of: equals, not equals, contains, not contains, greater then, smaller then — written without quotes. These are the same words the API and Generic dictionaries use. The last two compare numbers Thenuser sees element "statusMsg" contains text "Success"
Thenuser sees element "statusMsg" not contains text "Error"
user sees element {string} {enabledState} Assertion Verify whether an element can be used. {enabledState} is is enabled or is disabled — written without quotes. The element must be on screen either way Thenuser sees element "submitButton" is disabled
user sees checkbox {string} {checkedState} Assertion Verify whether a checkbox is ticked. {checkedState} is is checked or is unchecked — written without quotes Thenuser sees checkbox "termsCheckbox" is checked
user sees radio button {string} {checkedState} Assertion Verify whether a radio button is selected. {checkedState} is is checked or is unchecked — written without quotes Thenuser sees radio button "expressShipping" is unchecked
user sees field {string} {fieldState} Assertion Verify whether a field holds a value. {fieldState} is is empty or is not empty — written without quotes. A field holding only spaces counts as empty Thenuser sees field "commentsField" is empty
user sees field {string} with placeholder {string} Assertion Verify a field's placeholder text Thenuser sees field "emailField" with placeholder "Enter your email"
user defines variable from field {string} as name {string} Utility Save what a field currently holds under a name, and use it later in any sentence as {{name}} — see Dynamic values in any sentence on the parent page. Works on input fields only, not on labels or headings Thenuser defines variable from field "orderIdField" as name "orderId"
Whenuser enters value "{{orderId}}" in field "searchField"
user reports info {string} Utility Write a custom message to the test report Thenuser reports info "Checkpoint reached"

Defining Locators

See Using Cucumber Dictionary — section "Defining Locators (UI Dictionaries)" — for how the element identifiers used above are resolved.