Retrieve the URL of the current page or navigate to a new URL.

Usage

.url([url], [callback])
.url(callback)

Parameters

Name Type description
url
Optional
string|function

If missing, it will return the URL of the current page as an argument to the supplied callback.

callback
Optional
Function

Example

module.exports = {
 'demo Test' : function(browser) {
    browser.url(function(result) {
      // return the current url
      console.log(result);
    });

    // navigate to new url:
    browser.url('{URL}');

    // navigate to new url:
    browser.url('{URL}', function(result) {
      console.log(result);
    });
  }
}

W3C WebDriver spec