I am trying to input an amount in a text field which contains a default string.
HTML of that field:
<div class="InputGroup">
<span class="InputGroup-context">$</span>
<input autocomplete="off" class="Input InputGroup-input" id="amount" name="amount" type="text" maxlength="12" value="0.00">
</div>
When trying to input text to the field, instead of replacing the default text, it appends it to it.
I have tried to use amount.clear()
(amount is what I am calling the element) but after running that and sending the keys it throws the below exception:
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
As you will see from my current code, I am also trying to double click the default text but that doesn't help.
This is my code at the moment:
ActionChains(driver).move_to_element(amount).click(amount).click(amount).perform()
amount.send_keys(Keys.BACKSPACE)
amount.send_keys('100')
Which results in an input field of 0.00100 when I'm expecting 100.