'Selenium sendkeys - text field getting reset to default value
Using Selenium python,I need to enter text in Age field, but unable to achieve after trying below ways.
webdriver sendkeys method and Actions-sendkeys method doesn't work so I tried jsexecutor which performs sendkeys correctly BUT when once i complete rest of the fields on the form which includes drop-downs & textboxes, somehow the age field gets reset to default value . (This doesn't happen when form is filled manually)
self.driver.execute_script("arguments[0].value = '20'", element)
To fix above issue, I tried sending Keys.TAB using actions class after entering value in age field, but problem still persists.
ActionChains(self.driver).move_to_element(element).send_keys(Keys.TAB*30).perform()
Tried sending Keys.TAB using jsexecutor as well but no luck.
self.driver.execute_script(f"arguments[0].value = '\\t'", element)
Html code of the fields:
<input class="form-control input-sm controlValid" type="number" value="100"> == $0
Please suggest
Solution 1:[1]
Thank you Jonny Phelps and r2evans for your comments.
I should've just checked the difference between the columns.
env.data.x - env.data.z
Output was on the order of 1e-16, so not at all significant for my purposes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | testtest101 |
