Reputation: 11
I have an HTML element <input id="input-id" type="text" value="initial">
.
After loading the page I can get text from this element using, for example, driver.find_element_by_id("input-id").get_attribute("value")
.
But then I click on this element and change the text inside (to "edited", for example). Nothing in DOM changes, including value of the value
attribute
(i.e. driver.find_element_by_id("input-id").get_attribute("value")
still returns "initial" and element in DOM looks like <input id="input-id" type="text" value="initial">
)
How can I extract value that is now visible in browser (i.e. string "edited")? Do I need to execute some JavaScript or anything?
Upvotes: 1
Views: 2092
Reputation: 2454
That value doesn't change when you input some new text. You could try to do just this:
driver.find_element_by_id("input-id").get_attribute("innerHTML")
Upvotes: 3