The code aims to click on a button and then, which results in a new tab opening.
I want to work on that tab, but I’m unable to switch pages via browser.pages[i] because it doesn’t update instantaneously.
Any fix for this?
PS: 4 Hours into it, still, can’t figure this out. Really need some help.
await page.waitForSelector('.jobsearch-IndeedApplyButton-buttonWrapper').then(async (element) => {
await element.click()
})
let newTab= await browser.pages()[1]
await newTab.waitForSelector('.ia-BasePage-footer .dd-privacy-allow').then(async (element) => {
await newTab.click('.ia-BasePage-footer .dd-privacy-allow')
});
`
I’m expecting to get the element of the new tab and click it.
But, I can’t fetch it because I’m unable to switch my control to the new tab.
New contributor
Affan Khan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.