A URL assertion can confirm that your test is on the right web page during test execution. Some examples of use cases for URL assertions include:
- After clicking on a link, asserting that the test has navigated to the new URL
- Asserting that a certain ID that shows up on a page matches the ID in the URL
- Asserting that the URL path matches a variable value
For example, if you expect to see the login page after logging out of an application, and the URL was {{@app.url}}/login, you could assert that the pathname equals /login.

URL attributes and properties
To create a URL assertion, click on the check mark in the Trainer window and select URL assertion. Choose from one of the following URL assertions and properties:
Hash
The hash property sets or returns the anchor part of a URL, which includes the hash sign (#). For example, #sailingboat is the anchor part of the https://www.example.org/index.html#sailingboat URL.
Host/Hostname
The host property sets or returns the hostname and port of a URL. "Host" includes the port number if specified. If there's no port number specified in the URL, then it returns the same as the hostname. For example, "hostname" might provide "example.org" but host returns "example.org:7777".
Href
The href is an attribute of the anchor tag, and specifies the URL of the page that a link goes to. If there's no href attribute, then the link is not a hyperlink.
Password
A URL setting can sometimes include settings for user and password.
Pathname
This attribute is selected by default. The pathname property sets or returns the pathname of the URL.
Port
The port property sets or returns the port number that the server uses for a particular URL.
Protocol
The protocol property sets or returns the protocol of the URL, which includes the colon (:)
Search
The search property sets or returns the query-string section of a URL, which includes the question mark (?).
Username
The username property sets or returns the username section of the href attribute value. The username is entered by the user, and is specified after the protocol but before the password.

Attribute/property dropdown open showing what parts of a URL you can create assertions against.