By default, when you start recording a browser test, the mabl Trainer adds a visit URL step to the app.url
under test. If you need to visit other URLs in a test, you can add additional visit URL steps from the Trainer step menu: Add step > Visit URL.
If the record button is on, the Trainer also captures visit URL steps when you enter a URL in the address bar and press enter.
This article highlights use cases for adding additional visit URL steps to your tests:
- Directly access specific pages and states
- Navigate to dynamic URLs
Directly access specific pages and states
You can use visit URL steps as a shortcut to bypass the steps required to set up a specific page or state in your app.
For example, if it takes five clicks to get from the home page to the page that you want to validate, you can use a visit URL step to skip that navigation. As long as you have validated site navigation in another test, visit URL steps can help you create more focused tests and reduce test run time.
As another example, if you want to test a product page with a specific discount code applied, you can add a visit URL step with query parameters to access the page in a specific state: {{@app.url}}/products/123?discount=SUMMER20
Navigate to dynamic URLs
Since visit URL steps support variable interpolation, you can also leverage them to implement dynamic testing scenarios.
For example, if you want to navigate to a page URL that includes a dynamically generated product ID, store the ID in a variable, such as productID
, and use mabl variable syntax to reference the variable in the visit URL step: https://example.com/{{@productID}}
.