Skip to main content

getTitle

Get the title of the document shown in this browsing context. For a frame this is the title of the frame's own document.

Usage​

const context = await browser.url('https://webdriver.io')
await context.getTitle()

Example​

getTitle.js
it('reads the title of a background tab', async () => {
await browser.url('https://webdriver.io')
const tab = await browser.newWindow('https://webdriver.io/docs/api', { type: 'tab' })

console.log(await tab.getTitle()) // outputs the title of the API page
})

Returns​

  • <string> return: the document title

Welcome! How can I help?

WebdriverIO AI Copilot