स्विचविंडो
एक विशेष टैब / विंडो पर फोकस स्विच करें।
उपयोग
browser.switchWindow(matcher)
पैरामीटर्स
नाम | प्रकार | विवरण |
---|---|---|
matcher | String, RegExp | स्ट्रिंग या रेगुलर एक्सप्रेशन जो पेज टाइटल या URL, विंडो नाम, या विंडो हैंडल से मेल खाता है |
उदाहरण
switchWindow.js
it('should switch to another window', async () => {
// open url
await browser.url('https://google.com')
// get window handle
const handle = await browser.getWindowHandle()
// 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')
// switch back via window handle
await browser.switchWindow(handle)
});