#๐Ÿ”’ Playwright throwing timeout error

10 messages ยท Page 1 of 1 (latest)

slender ether
#

from playwright.sync_api import sync_playwright, Playwright

def run(playwright):
chromium = playwright.chromium
browser = chromium.launch(headless=True)
page = browser.new_page()
page.goto("https://www.newegg.com/asus-prime-rtx5080-o16g-nvidia-geforce-rtx-5080-16gb-gddr7/p/N82E16814126744")
page.wait_for_selector("product-title")
html = page.content()
browser.close()
with sync_playwright() as playwright:
run(playwright)

print("bombo")

This code being run results in a error of timeout, which means it waited for 30000ms for the selector to load, but it didnt load in that time... why didndt it load? i tried loading the page and it takes like 5 seconds for full page to load. also, i tried page.wait_for_selector("h1.product-title)

night forumBOT
#

@slender ether

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

night forumBOT
#

@slender ether

Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ Playwright throwing timeout error

kindred cargo
#

Playwright throwing timeout error

drifting ibex
#

Playwright couldn't find the selector you asked for (maybe because you're missing the period at the front). When you're looking for specific elements, try using the locators class. Here's a version that's slightly cleaner and uses locators:

from playwright.sync_api import sync_playwright, Playwright

with sync_playwright() as p:
    chromium = p.chromium
    browser = chromium.launch(headless=True)
    page = browser.new_page()
    page.goto("https://www.newegg.com/nvidia-geforce-rtx-4090/p/1FT-0004-00835")
    product_title = page.locator("css=.product-title")
    print(product_title.inner_text())
    html = page.content()
    browser.close()
#

Also, be sure to surround your code in triple back-quotes next time :)

#

Sorry I didn't keep the print("bombo") at the end. I hope you can forgive me.

night forumBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.