Saltar al contenido principal

switchWindow

Cambia el enfoque a una pestaña / ventana particular.

Uso
browser.switchWindow(matcher)
Parámetros
NombreTipoDetalles
matcherString, RegExpCadena o expresión regular que coincide con el título de la página o URL, el nombre de la ventana, o el manejador de la ventana
Ejemplo
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)
});

Welcome! How can I help?

WebdriverIO AI Copilot