Let's say we have this website https://www.coinichiwa.com/ which has a BET AMOUNT input box. It's html is:
<input autocomplete="off" id="betFa" name="a" maxlength="20" value="0.00000000" class="betinput" style="">
I need to add some value into it. Here is my code:
browser = webdriver.Firefox()
browser.get('https://www.coinichiwa.com')
browser.find_element_by_id("betFa").send_keys("0.00000005")
print browser.find_element_by_xpath("//input[contains(@id,'betFa')]").text
But it's neither setting it's value to "0.00000005" nor it printing the value
of input.
I'm not sure what's going wrong. Can you suggest? Why it's not working?
You need to
clear()
the text input first:As for the your second problem - this is an
input
and the value you enter into it is kept inside thevalue
attribute, not the text. Useget_attribute()
method: