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
问题解决。