Timeout error when navigating from one webpage to another using Playwright with Python

Firstly, apologies if this is categorized incorrectly.

I am hoping someone can help me on my automation project, I am using Playwright with Python for it.

I am simply trying to automate some text fields, navigate to the next page of a web page and submit.

Halway through, when hitting the next button to navigate from one page to the next, I’m getting a timeout error when the “Next” button is clicked.

I’m pretty sure I am using the correct selector for the button because the next webpage actually loads in the browser when not in headless mode.

I tried inserting wait for both the next element and the first element on the next page, as well as wait for URL of the next webpage but the same timeout error keeps getting thrown on the next button.

Here is a copy of my code:

def step2():
“”“user edits address, phone number and email”“”
page = browser.page()
page.click(“id=change email yes”)
selector = “id=next”
page.wait_for_selector(selector, state=“visible”)
page.click(selector, timeout=10000)

def step3():
“”“user enters billing address”“”
page = browser.page()
selector = “id=Address1”
page.wait_for_selector(selector, state=“visible”)
page.click(selector, timeout=10000)

Here is a screenshot of the log where the error is being thrown:

Hi Stephen,

You seem to be doing things the hard way? is there a reason you are not using Browser Library?

FYI - Browser library has already built all the Robot Framework keywords you should need to use Playwright with Robot Framework, is well tested, and used by many people in this community.


1 Like