[Python] "How to fix 'attempting click action: waiting for element to be visible' error when...

Discussão em 'Python' iniciado por Stack, Fevereiro 9, 2025.

  1. Stack

    Stack Membro Participativo

    I have a website, let's say "exampleA.com"

    There are 12 clickable boxes on it, and clicking each box will take me to a different page. For example, clicking box1 will take me to page1.com, clicking box2 will take me to page2.com. I want to click every box on this page.

    I am currently facing an issue where I get the following error

    playwright._impl._api_types.Error: Element is not attached to the DOM.
    attempting click action: waiting for element to be visible, enabled and stable


    while running the following code:

    boxes = page.query_selector_all(".something")
    box1.click()
    page.go_back()
    box2.click()
    page.go_back()


    I have tried adding the following in between the code:

    page.wait_for_load_state("networkidle")
    page.wait_for_timeout(5000)


    But the error still persists. How can I fix this bug?

    Continue reading...

Compartilhe esta Página