Selenium version update problem: AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'

"Junior Question TT"

The error is as follows:

Selenium reports an error based on id positioning:

AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'

Current writing:

driver.find_element_by_id("kw").send_keys("selenium")

solution:

Import By package

from selenium.webdriver.common.by import By
driver.find_element(By.ID,"kw").send_keys("selenium")

Guess you like

Origin blog.csdn.net/weixin_46761622/article/details/128479618
Recommended