>>> from selenium import webdriver
>>> driver = webdriver.Firefox()
>>> driver.get("http://www.baidu.com")
>>> driver.find_element_by_id("kw").send_keys("selenium2")
到第四句出现下面错误,怎么解决?????
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
driver.find_element_by_id("kw").send_keys("selenium2")
File "F:\python\lib\site-packages\selenium\webdriver\remote\webelement.py", line 352, in send_keys
'value': keys_to_typing(value)})
File "F:\python\lib\site-packages\selenium\webdriver\remote\webelement.py", line 501, in _execute
return self._parent.execute(command, params)
File "F:\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 311, in execute
self.error_handler.check_response(response)
File "F:\python\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element is not visible
报错 Element is not visible
在打开百度主页后,查找id前加时间等待试试