python3.5 _x86
system:win7_x64
selenium3.5
geckodriver:0.18.0_x64
firefox:55_x64
代码:
from selenium import webdriver import time driver = webdriver.Firefox(executable_path=u'C:\Program Files (x86)\Mozilla Firefox\geckodriver.exe') driver.get('http://www.baidu.com') time.sleep(0.5) input = driver.find_element_by_name('wd') input.clear() input.send_keys('1234567890') time.sleep(0.5) driver.find_element_by_css_selector('#su').click()
错误:
D:\Python\Python35-32\python.exe D:/PycharmProjects/untitled1/bai.py Traceback (most recent call last): File "D:/PycharmProjects/untitled1/bai.py", line 10, in <module> input.send_keys('1234567890') File "D:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 350, in send_keys 'value': keys_to_typing(value)}) File "D:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 499, in _execute return self._parent.execute(command, params) File "D:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 297, in execute self.error_handler.check_response(response) File "D:\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Expected [object Undefined] undefined to be a string
这是为什么呢??
所有用到的都升到了最新了。
火狐浏览器太高,换成低版本火狐浏览器试试。
https://ftp.mozilla.org/pub/firefox/releases/47.0.1/
这是Firefox47版本的,换个低点版本浏览器就可以了
为什么最新版不行呢。
是不支持了吗?