我不能将send_keys用于chrome webdriver

时间:2018-03-23 11:24:31

标签: python selenium chrome-web-driver

我创建了一个Python webdriver程序,我使用了send_keys,我发现了这个错误:

Traceback (most recent call last):
  File "D:/Amazon FBA/amazon-100-botzi/templates/send_keys_v2.py", line 10, in <module>
    elem.clear()
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 95, in clear
    self._execute(Command.CLEAR_ELEMENT)
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
  (Session info: chrome=65.0.3325.181)
  (Driver info: chromedriver=2.29.461591 (62ebf098771772160f391d75e589dc567915b233),platform=Windows NT 10.0.16299 x86_64)

是关于chrome webdriver版本还是chrome版本?我应该使用什么版本?我怎么解决这个问题?我附上了代码。我将不胜感激。

from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome(executable_path="C:\\Users\Andrei\Downloads\webdriver\chromedriver.exe")

driver.get("http://www.python.org")

elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source

0 个答案:

没有答案