selenium 3.6.0 geckodriver的一次坑
Posted 遥远的绿洲
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了selenium 3.6.0 geckodriver的一次坑相关的知识,希望对你有一定的参考价值。
Traceback (most recent call last):
File "./se3.py", line 16, in <module>
dr=webdriver.Firefox(firefox_binary=binary,executable_path=driver_path)
File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/firefox/webdriver.py", line 154, in __init__
keep_alive=True)
File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 151, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 240, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/opt/python36/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: failed to lookup address information: Name does not resolve
一开始以为是geckodriver的问题,于是在不同的geckodriver换来换去,firefox也试过不同的版本,然而并没有解决。百度了一下也没有相关的问题。
最后还是看错误信息,failed to lookup address information: Name does not resolve,
启动geckodriver的时候1508740937900 geckodriver INFO Listening on 127.0.0.1:4444
想到会不会是/etc/hosts的问题,于是在/etc/hosts上添加
127.0.0.1 localhost
问题解决。
以上是关于selenium 3.6.0 geckodriver的一次坑的主要内容,如果未能解决你的问题,请参考以下文章
selenium 3.6.0 geckodriver的一次坑