I've been trying to fill in a web form using Selenium in Python. It's a simple enough task, and the code I'm using is this:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("https://...")
elem = driver.find_element_by_id("receipt_number")
elem.clear()
elem.send_keys("13lettercode")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()
After inspecting the web form element I got this:
<input id="receipt_number" name="appReceiptNum" type="text" class="form-control textbox" maxlength="13">
The website gives me an error saying that my code is invalid, and I'm wondering if there's anything obvious that I'm doing wrong. Thanks for your help!