I'm trying to learn selenium and I want to fill out a form and copying some tutorial . In this form there a text input with this code :
<input required="" autocomplete="off" placeholder="First Name" type="text" id="firstName" >
Following the tutorial this code should do it :
from selenium import webdriver as w
d=w.Chrome(executable_path="C:\\chromedriver.exe")
d.get("https://demoqa.com/automation-practice-form")
try :
d.find_element_by_id('firstName').send_keys("TEST")
except:
print('cant identify')
d.quit()
I think the problem is the find element syntax anyways what is the problem ?
CodePudding user response:
To send a character sequence to the <input>
field you need to induce
CodePudding user response:
d.find_element("xpath",'//*[@id="firstName"]').send_keys("amine") d.find_element("id","lastName").send_keys("wannes")