I'm working with Selenium in Python. I would like to get the .val()
of a <select>
element and check that it is what I expect.
This is my code:
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?
How can I do this? The Selenium documentation seem to have plenty about selecting elements but nothing about attributes.
get_attribute(name)
might do the job, although I don't think I've actually used it. Give it a shot! – Underwood