Search code examples
pythonplaywrightplaywright-python

playwright is timing out before running page.pause()


everything was running fine the code opened a website and carried out some functions

i took a 60 min break and now playwright refuses to do even the most basic function

it loads the website and times out i wrote a new code to test what was wrong and even that failed

from playwright.sync_api import sync_playwright
import time
with sync_playwright() as p:
    brower = p.chromium.launch(headless=False, slow_mo=50)
    page = brower.new_page()
    page.goto('https://www.zameen.com/')
    page.pause()
Traceback (most recent call last):
  File "e:\playwrightzameen.py", line 6, in <module>
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\pyton\Lib\site-packages\playwright\_impl\_connection.py", line 419, in wrap_api_call
    return await cb()
           ^^^^^^^^^^
  File "E:\pyton\Lib\site-packages\playwright\_impl\_connection.py", line 79, in inner_send
    result = next(iter(done)).result()
             ^^^^^^^^^^^^^^^^^^^^^^^^^
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
navigating to "https://www.zameen.com/", waiting until "load"
============================================================

i tried to uninstall and reinstall playwright


Solution

  • That happens because your webpage did not load totally, you can set a timeout like:

    page.goto('https://www.zameen.com/', timeout=100000)
    

    Or you can even don't wait till your page is loaded and just navigate without waiting the page to be fully loaded with timeout=0

    page.goto('https://www.zameen.com/', timeout=0)