Paganini
Paganini

Reputation: 310

How to find a new browser window using webdriver io?

I am writing CoffeeScript tests using Webdriver.io and mocha.

I cannot resize the window in Google Chrome browser. I was told that the window.resizeTo(width, height) command can only resize the window if the window was created by the window.open () command. However, if I create a new window with the window.open() command, I don't know how to find this new window using Webdriver IO. Help me!

Upvotes: 0

Views: 540

Answers (1)

PDHide
PDHide

Reputation: 19989

it('Sorts the inventory in asc order of price and adds element to cart', async () => {
   await browser.url("https://www.google.com")
   await browser.setWindowSize(200,100)
});

use serwindowsize if you are using wdio v7 and for new window use:

await browser.newWindow('https://webdriver.io', { windowName: 'WebdriverIO window', windowFeature: 'width=420,height=230,resizable,scrollbars=yes,status=1', })

Upvotes: 1

Related Questions