getTitle

Get the title of current opened website. This command only works for browser environments or on mobile devices with webview enabled (hybrid tests).

Usage

1
browser.getTitle();

Example

getTitle.js
1
2
3
4
5
6
7
8
it('should get the title of the document', function () {
browser.url('http://webdriver.io');

var title = browser.getTitle()
console.log(title);
// outputs the following:
// "WebdriverIO - WebDriver bindings for Node.js"
});

Returns

  • <String>: current page title

Uses