Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

switch window

const assert = require('assert')

describe('v5.webdriver.io', () => {

    it('should switch to another window', async () => {

         // open url
        await browser.url('https://google.com')

        // create new window
         await browser.newWindow('https://v5.webdriver.io');
         await browser.pause(2000);

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

         // switch back via title match
         await browser.switchWindow('Next-gen WebDriver test framework for Node.js')
        
         await browser.pause(2000);

        })
    
})
 
PREVIOUS NEXT
Tagged: #switch #window
ADD COMMENT
Topic
Name
5+3 =