最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Lost url while using playwright to open new page in python - Stack Overflow

programmeradmin5浏览0评论

I have two pages, page0 and page1. I clicked a button in page1, and it popup a blank page to load for 3-5 minutes. After that, it will popup a new page, and close all the pages except page0. However, playwright lost the final page url. it only has the first page's url.

If anyone can help me to solve this problem, I'll be really grateful!

Here's my code

async with self.context.expect_event('page', timeout = 60000) as page2_info:
    await page1.locator("#fraInterface").content_frame.get_by_role("button", name = "Finish Input").click()
page2 = self.context.pages[-1]

I tried to use two async to find the url, but it did not work. I also tried to use different method, such as change self.context.expect_event('page') to page1.expect_popup(). Both can not work in this situation.

发布评论

评论列表(0)

  1. 暂无评论