Reputation: 1
i have write code for multiple windows. i.e when i click on button it will open new window then in that window i have to do click operation . i have used this code const y=await ClientFunction(() => window.location.pathname)()
await t.switchToWindow(f => f.url.pathname === y)
Upvotes: 0
Views: 571
Reputation: 6318
In general, your approach is correct. Take a look at this sample:
fixture `fixture`
.page `http://example.com`;
test(`test`, async t => {
await t.openWindow('http://google.com');
await t.switchToWindow(data => {
return data.url.hostname === 'example.com';
});
await t.click('h1');
});
If it does not help, please share a sample that demonstrates the issue.
Upvotes: 1