Trying to enter the value "100000" into a web form using Selenium in Python, but it is consistently not working no matter how I try to send it.
I apologize for my lack of knowledge about the terminology. I will try my best but I am self-taught and a novice. Also, I apologize but I cannot tell you the website or my employer would not be very happy.
The box on the webpage is automatically populated with a dollar sign. I know that the box in the web form is expecting an integer in currency format. When I look at the html element on the web page it gives the following information
<input type="number" step="1" name="moneying" size="35" id="moneying"
class="moneying input currency error" value="" data-type="currency" data-
mandopt="mand" required="" pattern="[\$]?[0-9]+[\.]?[0-9]*" min="500"
onblur="validate(this);">
I have tried:
- using the send_keys class just plain without any variation
- clicking the box before using send_keys
- clearing the box before using send_keys
- waiting until the element can be located on the page and then doing all the above
- using send_keys with Keys.NUMPAD#
- adding $ in the beginning of the number
- adding \$ in the beginning of the number
- using Firefox driver instead of Chrome driver
- entering the value as 100000.00 and 100000
Current version of my code:
from selenium import webdriver
driver = webdriver.Chrome('location on my pc')
try:
driver.get(r"relevant web page")
moneying_box_wait = WebDriverWait(driver,20).until(EC.presence_of_element_located((By.ID,"moneying")))
moneying_box = driver.find_element_by_id("moneying")
moneying_box.click()
moneying_box.clear()
moneying_box.send_keys("100000")
I want it to enter 100000 in the box. Nothing appears in the box at all.