I want to play all the videos on some website with playwright:
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")
Sign in with name and password and numbers in QR code,it can’t be done automatically,then input the following codes in python console:
urls = ["url1_some_video_website",
"url2_some_video_website"]
#for privacy,i can't write the whole url,the html structure in
#the urls make these command works
#page.get_by_text("play").click()
#page1.get_by_role("img").click()
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()
I find that only url1 can play.Why only the url1 can play ? How to make all of them to play with playwright?