进入python终端,交互式运行,输入:
from playwright.sync_api import Playwright, sync_playwright, expect
playwright = sync_playwright().start()
browser= playwright.firefox.launch(headless=False)
context = browser.new_context()
page = context.new_page()
page.goto("some_video_website")
输入账号,密码,二维码,以我目前的实力,无法用程序自动识别二维码,因此手动完成。再输入:
urls = ["url1_some_video_website",
"url2_some_video_website"]
for url in urls:
page.goto(url)
with page.expect_popup() as page1_info:
#在那个网页结构中,下面成立
page.get_by_text("play").click()
page1 = page1_info.value
page1.get_by_role("img").click()
我的本意是让浏览器自动播放url1,url2,但是我发现这个for循环,仅仅能播放第一个视频,请问,如何修改一下,完成两个视频都自动播放呢?