[Python] How to search with xpath selector in "nodriver" on python

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

  1. Stack

    Stack Membro Participativo

    I am not sure about the correct way to search for specific items using XPath in nodriver on python.

    I'm using this for try to select a button with a "confirm" text inside.

    await tab.select("button[contains(text(),'confirm'])")


    But i receive this output:

    File "XXXXXX", line 56
    totp_ig = await tab.select("button[contains(text(),'confirm')]")
    File "XXXXXX\lib\site-packages\nodriver\core\tab.py", line 242, in select
    return items
    NameError: name 'items' is not defined


    I only could search items with css selector like:

    await tab.select(f"input[name=something]")


    How can i search via xpath and not css?

    Thanks.

    Continue reading...

Compartilhe esta Página