I have a page with an element:
<input id="foo"></input>
which (via Javascript) has had its value
set to "bar".
If I use the following XPath statement (with Python/Selenium):
self.browser.find_elements_by_xpath("//input[@id='foo']")
it returns my element, and I can even do:
self.browser.find_elements_by_xpath("//input[@id='foo']")[0].get_attribute("value")
and get u"bar"
back. However, if I try to do:
self.browser.find_elements_by_xpath("//input[@value='bar']")
or even just:
self.browser.find_elements_by_xpath("//input[@value]")
my element doesn't get returned.
The only way this makes sense to me is if my Javascript code is setting the "value" property, not the "value" attribute (and when I look at the element in the Firefox inspector it doesn't show a "value" attribute, which reinforces this theory).
So, my question is, how do I select elements with a "value" property instead?