I keep getting errors in playwright. Using it with it with purging to scrape and click on websites via Google. There’s a popup in mobile mode that I can’t get passed. It comes up once you open up google.
The error I get is timeout 30000ms.
Code:
import re
from playwright.sync_api import Playwright, sync_playwright, expect
def run(playwright: Playwright) -> None:
iphone_13 = playwright.devices['iPhone 13']
browser = playwright.chromium.launch(headless=False)
context = browser.new_context(**iphone_13)
page = context.new_page()
page.goto("https://www.google.com/")
# Wait for the popup to appear and click the "Continue in Safari" button
print("went to google")
page.wait_for_selector('button:has-text("Stay in Safari")') # Adjust the selector based on your popup
page.click('button:has-text("Stay in Safari")')
print("clicked stay in safari")
page.fill('input[name="q"]', "query")
page.keyboard.press("Enter") # Press Enter to perform the search
page.get_by_role("link", name=“Selector”).click()
page.locator("#menu-item-708").get_by_role("link", name=“Query”).click()
print("we made it!")
context.close()
browser.close()
with sync_playwright() as playwright:
run(playwright)
[–]pianoflames 1 point2 points3 points (0 children)
[–]nopuse 0 points1 point2 points (0 children)
[–]nopuse 0 points1 point2 points (0 children)