முக்கிய உள்ளடக்கத்திற்கு செல்க

switchWindow

Switch focus to a particular tab / window.

Usage
browser.switchWindow(matcher)
Parameters
NameTypeDetails
matcherString, RegExpString or regular expression that matches the title and url of the page or window name
Example
switchWindow.js
it('should switch to another window', async () => {
// open url
await browser.url('https://google.com')

// create new window
await browser.newWindow('https://webdriver.io')

// switch back via url match
await browser.switchWindow('google.com')

// switch back via title match
await browser.switchWindow('Next-gen browser and mobile automation test framework for Node.js')
});

Welcome! How can I help?

WebdriverIO AI Copilot