LambdaTest Community

Find answers, support, and inspiration from other users

Questions
LambdaTest Community
Answered

How can I open a new window with WebDriver.io?

Can anyone please tell me how can I open a new window with WebDriver.io.

Up Vote Down Vote 0 Votes
Posted 3 months ago

Answers


newWindow command is used when you want to open a new url on a new browser window. Other parameters included are windoname and window features. You can use them to set the name of the window along with its size, position etc respectively.

Syntax:

browser.newWindow(url, NewWindowName, NewWindowsFeature) Example: Open two URL <any url> and <Google> then search particular text on newly open window

describe("Browser Commands ", function() {
it("newWindow example ", function() {
browser.url("<any url>");
browser.newWindow(
"<Google>",
"Google Window",
"width=800,height=700,resizable,scrollbars=yes,status=1"
);
browser.pause(5000);
console.log(browser.getTitle());
// opening Google and writing text on newly opened window
$(".//input[@name='q']").setValue("<Any URL>");
browser.pause(5000);
});
});
Up Vote Down Vote 0 Votes
Posted 2 months ago
103 Views
1 Answer
3 months ago