Common Web Steps - simon-sai/selenium-appium-java GitHub Wiki
I open url {string}
When I open url "https://www.example.com"
The purpose of this step is to allow your test scenario to dynamically navigate to any URL provided in the feature file. It helps automate the process of opening a webpage during test execution and logs the action for tracking in reports.
I send text {string} to the tag {string} has {string} is {string}
And I send text "Hello World" to the tag "input" has "type" is "text"
The purpose of this step is to:
- Log the action: Provide a clear report of the action being performed.
- Process the text: Handle any necessary transformations or configurations for the text.
- Dynamically locate the element: Find the correct web element using a combination of the tag, attribute, and attribute value.
- Send the text: Input the text into the located web element.
This step is flexible for dynamic interactions with web pages where elements can be located using different attributes. It ensures that the interaction is logged and performed correctly, enhancing both the maintainability and transparency of the test.
I click on tag {string} has {string} is {string}
And I click on tag "button" has "class" is "submit-btn"
The purpose of this step is to:
- Log the action: Clearly report what element is being clicked in the test execution logs.
- Dynamically locate the element: Build a locator based on the tag, attribute, and attribute value to identify the exact element on the page.
- Perform the click: Use Selenium WebDriver (or another web automation tool) to interact with the web page and simulate a click on the identified element.
This step is useful for scenarios where the element to be clicked is identified by both its tag and a specific attribute, making it adaptable for different elements on a web page with varying attributes.
I see tag {string} has text is {string}
Then I see tag "h1" has text is "Welcome"
The purpose of this step is to:
- Log the action: Provide a clear log entry documenting what element and text are being checked.
- Process the text: Ensure that the text is correctly formatted or configured before the check.
- Locate the element: Find the HTML element that matches the specified tag and contains the given text.
- Verify visibility: Ensure that the element is visible on the page.
This step is particularly useful in tests where you need to confirm that specific text is displayed on the page, and it can be applied dynamically to various tags and text values.
I press {string} on web
When I press "Enter" on web
The purpose of this step is to:
- Log the action: Track the key press event in the test report.
- Simulate key press: Perform a keyboard action (like pressing Enter, Tab, or other keys) on the web page to trigger interactions like form submission or navigation.
This step is particularly useful for scenarios where actions like pressing Enter or navigating with Tab are needed as part of the test flow. It allows for dynamic simulation of various key presses.
I type {string} on web
When I type "Hello World" on web
The purpose of this step is to:
- Log the action: Track what text is being typed in the test report.
- Simulate typing: Perform the action of typing a specific string of text on the web page, as if a user were manually entering the text into an input field.
This step is particularly useful for test scenarios that involve form filling or interacting with any text fields, allowing for flexible text input during automated tests.
I type random content start with {string} on web
When I type random content start with "email-subject-" on web
The purpose of this step is to:
- Log the action: Track the prefix of the random content being typed in the test report.
- Generate random content: Dynamically create a string that starts with a specific prefix and ends with a random sequence of characters.
- Simulate typing: Input the randomly generated string into a text field on the web page, mimicking a user entering text.
This step is useful in automated tests where you need unique content in each test run, such as testing form inputs that require random, non-repeating text entries.