[Python] Selenium webdriver: How do I find ALL of an element's attributes?

Discussão em 'Python' iniciado por Stack, Junho 6, 2025.

  1. Stack

    Stack Membro Participativo

    In the Python Selenium module, once I have a WebElement object I can get the value of any of its attributes with get_attribute():

    foo = elem.get_attribute('href')


    If the attribute named 'href' doesn't exist, None is returned.

    My question is, how can I get a list of all of the attributes that an element has? There doesn't seem to be a get_attributes() or get_attribute_names() method.

    I'm using version 2.44.0 of the Selenium module for Python.

    Continue reading...

Compartilhe esta Página