Learning selenium positioning element, the teacher wrote send_ Key (), but I didn’t click in this method. I kept prompting
selenium Python send_ Key error: list object has no attribute
therefore, both methods can be used to solve the problem.
PS: [0] I don’t know what it means. I’ll come back to understand it when I’m in-depth learning
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
userID = driver.find_elements(By.ID,"kw")[0]
userID.send_keys("123")
driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
driver.find_element(By.ID,"kw").send_keys("456")