How to get an attribute of an element from Selenium

You are probably looking for get_attribute(). An example is shown here as well

def test_chart_renders_from_url(self):
    url="http://localhost:8000/analyse/"
    self.browser.get(url)
    org = driver.find_element_by_id('org')
    # Find the value of org?
    val = org.get_attribute("attribute name")

Leave a Comment