Skip to main content

url

The url command loads an URL in the browser. If a baseUrl is specified in the config, it will be prepended to the url parameter using node's url.resolve() method. Calling browser.url('...') with the same url as last time will trigger a page reload. However, if the url contains a hash, the browser will not trigger a new navigation and the user has to refresh the page to trigger one.

The command returns an WebdriverIO.Request object that contains information about the request and response data of the page load:

interface WebdriverIO.Request {
id?: string
url: string
timestamp: number
navigation?: string
redirectChain?: string[],
headers: Record<string, string>
cookies?: NetworkCookie[]
\/**
* Error message if request failed
*\/
error?: string
response?: {
fromCache: boolean
headers: Record<string, string>
mimeType: string
status: number
},
/**
* List of all requests that were made due to the main request.
* Note: the list may be incomplete and does not contain request that were
* made after the command has finished.
*
* The property will be undefined if the request is not a document request
* that was initiated by the browser.
*\/
children?: Request[]
}

The command supports the following options:

note

These features unfortunately won't be available to you if your remote environment doesn't support WebDriver Bidi. You can check if Bidi is support in your session by looking into the browser.isBidi property.

wait

The desired state the requested resource should be in before finishing the command. It supports the following states:

  • none: no wait after the page request is made and the response is received
  • interactive: wait until the page is interactive
  • complete: wait until the DOM tree of the page is fully loaded
  • networkIdle: wait until there are no pending network requests

headers

Headers to be sent with the request.

Default: {}

auth

Basic authentication credentials. Note: this will overwrite the existing Authorization header if provided in the headers option.

timeout