Reputation: 12859
I'm writing Selenium tests and need to check that javascript correctly sets the text in certain fields.
I've been trying to use .text
to get the text value of a particular Webelement like so;
test = WebDriverWait(self.ff, 10).until(lambda driver : driver.find_element_by_xpath("//input[@id='id_testText']"))
assert test.text == u'TEST'
But test.text
never gets a value.
I can .clear()
it and also .send_keys()
to it, but even with these I can't get a value. So where am I going wrong in trying to test it's value?
Upvotes: 0
Views: 1384
Reputation: 2019
Why using wait to get webelement? Anyway
test = WebDriverWait(self.ff, 10).until(lambda driver : driver.find_element_by_xpath("//input[@id='id_testText']"))
text = test.get_attribute('value')
assert text == u'TEST'
Upvotes: 3