首页 新闻 会员 周边 捐助

selenium + python 进行自动化时出现错误

0
[待解决问题]

>>> 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

新手测试的主页 新手测试 | 菜鸟二级 | 园豆:206
提问于:2017-12-06 08:07
< >
分享
所有回答(1)
0

报错 Element is not visible

在打开百度主页后,查找id前加时间等待试试

ycyzharry | 园豆:25683 (高人七级) | 2017-12-06 08:53
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册