简体   繁体   English

硒python send_keys停止工作

[英]selenium python send_keys stop working

This short trivial code worked fine as of bef. 这段简短的代码从bef开始运作良好。 yesterday, but now send_keys is not working anymore: 昨天,但现在send_keys不再起作用:

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.google.com")
elem = driver.find_element_by_name("q")
elem.send_keys("Hello WebDriver!")
elem.submit()
print(driver.title)

This is the stack trace: 这是堆栈跟踪:

C:\Users\Rui\PycharmProjects\geo\venv\Scripts\python.exe C:/Users/Rui/PycharmProjects/geo/send_keys.py
debug value ('Hello WebDriver!',)
Traceback (most recent call last):
  File "C:/Users/Rui/PycharmProjects/geo/send_keys.py", line 5, in <module>
    elem.send_keys("Hello WebDriver!")
  File "C:\Users\Rui\PycharmProjects\geo\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 483, in send_keys
    'value': keys_to_typing(value)})
  File "C:\Users\Rui\PycharmProjects\geo\venv\lib\site-packages\selenium\webdriver\remote\webelement.py", line 632, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\Rui\PycharmProjects\geo\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Rui\PycharmProjects\geo\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, 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.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT

6.1.7601 SP1 x86) 6.1.7601 SP1 x86)

Process finished with exit code 1

(the string: (字符串:

debug value ('Hello WebDriver!',) 调试值(“ Hello WebDriver!”,)

results that trying to understang what is going on, in "webelement.py" I added this line "print("debug value " + str(value))": 结果是试图弄清楚发生了什么,在“ webelement.py”中我添加了这一行"print("debug value " + str(value))":

def send_keys(self, *value):
    # 2018MAR25
    # send_key generating errors since 2018MAR24!
    print("debug value " + str(value))

And as it really prints "debug value ('Hello WebDriver!',)" I cannot understand why "webelement.py" is complaining that "call function result missing 'value'" 而且因为它确实显示“调试值('Hello WebDriver!',)”,所以我不明白为什么“ webelement.py”抱怨“调用函数结果缺少“值””

Can someone enlighten me? 有人可以启发我吗? How can i solve this issue? 我该如何解决这个问题? I noticed that Chrome was updated to 65 around this date, could it be related? 我注意到Chrome大约在这一日期更新为65,这可能相关吗?

Windows 7 32 bit Windows 7 32位

Selenium 3.11.0 硒3.11.0

Python 3.6.4 的Python 3.6.4

2017-12-19 Chrome 2017-12-19铬

65.0.3325.181 2018-03-22 65.0.3325.181 2018-03-22

Thanks, Rec 谢谢,Rec

Your chrome driver seems not latest. 您的Chrome驱动程序似乎不是最新的。 if you are using chrome 65 then you need latest chrome driver. 如果您使用的是chrome 65,则需要最新的chrome驱动程序。

Please take latest version of chrome driver from here : https://chromedriver.storage.googleapis.com/index.html?path=2.37/ 请从此处获取最新版本的chrome驱动程序: https : //chromedriver.storage.googleapis.com/index.html?path=2.37/

It should resolve your sendkey issue. 它应该可以解决您的sendkey问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM