AttributeError: 'WebDriver' object has no attribute 'Keys'
时间: 2023-09-30 15:04:26 浏览: 90
这个错误是因为在使用 Selenium WebDriver 的时候,调用了一个未定义的方法 'Keys'。为了解决这个问题,你需要导入正确的模块,并使用正确的方法来调用 'Keys'。引用中提到,你可以通过导入正确的 WebDriver 方法来解决这个问题,具体的代码如下:
from selenium.webdriver.common.keys import Keys
driver.find_element_by_id("your_element_id").send_keys(Keys.ENTER)
这样就可以正确地使用 'Keys' 方法了。希望能帮到你。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [完美解决:python selenium 报错 AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_...](https://blog.csdn.net/wei9693312/article/details/127689830)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_by_id](https://blog.csdn.net/weixin_44048117/article/details/130919428)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文