Appearance
Navigation
The first action you will almost certainly take is to open a webpage. Navigation is how your test moves from one page to another—whether by loading a URL directly, clicking a link, or submitting a form.
Navigating to a page
To navigate directly to a URL, use the I.goTo() command.
js
I.goTo("https://example.com")This loads the specified URL in the current browser tab.
Using relative paths
You can also use I.goTo() with a relative path.
js
I.goTo("/cart")When a relative path is used, UI-licious resolves it against the current base URL of the browser. For example, if the browser is currently on https://example.com, the command above will navigate to https://example.com/cart.
Opening a new tab
You can also open a URL in a new browser tab:
js
I.goTo("https://example.com", { newTab: true })Automatic waiting after navigation
Whenever a page navigation is triggered by any means (including page navigations triggered by clicks or form submissions), UI-licious will automatically wait for the page to finish loading before proceeding with the next command.
This ensures that the styles, images, fonts, and Javascript code needed for the page to be interactive are properly loaded to avoid flaky unstable tests caused by slow responses from the server or the network.
UI-licious will wait for up to 5 minutes for all blocking assets to be loaded on the page. The time taken to complete I.goTo() commands (and any command that triggers a page navigation) includes the total time taken to load the page.
Verifying the current page
After navigation, it is often useful to verify that the browser has reached the expected page.
UI-licious provides the I.amAt() command to validate the current URL:
js
I.goTo("https://example.com")
I.click("View Cart")
I.amAt("/cart")This confirms that the browser is at the expected location before continuing the test.
I.amAt() supports validating full URLs, relative paths, query strings, hashes, and regular expressions. Refer to the I.amAt reference to learn more.
Refreshing the page
To reload the current page, use:
js
I.refreshPage()This refreshes the page in the active browser tab.