【Selenium】【BugList7】执行driver.find_element_by_id("kw").send_keys("Selenium"),报错:selenium.common.exceptions.InvalidArgumentException: Message: Expected [object Undefined] undefined to be a string
【版本】
selenium:3.11.0
firefox:59.0.3 (64 位)
python:3.6.5
【代码】
1 #coding=utf-8 2 from selenium import webdriver 3 4 driver = webdriver.Firefox() 5 driver.get("http://www.baidu.com") 6 7 driver.find_element_by_id("kw").send_keys("Selenium") 8 driver.find_element_by_id("su").click() 9 driver.quit()
【报错】
==================== RESTART: E:/python_work/1 firefox.py ====================
Traceback (most recent call last):
File "E:/python_work/1 firefox.py", line 7, in <module>
driver.find_element_by_id("kw").send_keys("Selenium")
File "D:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\webelement.py", line 479, in send_keys
'value': keys_to_typing(value)})
File "D:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "D:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "D:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Expected [object Undefined] undefined to be a string
【解决方法】
升级geckodriver到v0.21.0已解决:https://github.com/mozilla/geckodriver/releases
【Ending】
微信公众号“粒粒的测试笔记”