Javascript 我如何切换到新的弹出窗口,例如在playwright中单击“向谷歌注册”时

Javascript 我如何切换到新的弹出窗口,例如在playwright中单击“向谷歌注册”时,javascript,jestjs,e2e-testing,webautomation,playwright,Javascript,Jestjs,E2e Testing,Webautomation,Playwright,我正在尝试访问新的弹出窗口,以便谷歌在playwright中注册,但无法完成 await page.waitForSelector(signUpWithGoogle, { state: 'visible' }) await page.focus(signUpWithGoogle) await page.click(signUpWithGoogle) await page.fill('//input[@type="email"]', email) 您应该等待弹出窗口,然后对其

我正在尝试访问新的弹出窗口,以便谷歌在playwright中注册,但无法完成

await page.waitForSelector(signUpWithGoogle, { state: 'visible' })
await page.focus(signUpWithGoogle)
await page.click(signUpWithGoogle)
await page.fill('//input[@type="email"]', email)

您应该等待弹出窗口,然后对其执行操作:

wait page.waitForSelector(使用Google注册,{state:'visible'})
等待页面。焦点(使用谷歌注册)
const[popup]=等待承诺。全部([
page.waitForEvent(“弹出窗口”),
页面。单击(使用谷歌注册),
]);
等待弹出。填充('//input[@type=“email”]',email)

非常感谢您的帮助!!:)