2016-05-14 65 views
0

我在本地計算機上使用硒,但有時我得到一個我不完全瞭解的套接字錯誤。到目前爲止,重新啓動(Python)應用程序已爲我工作。硒沒有RC:連接拒絕

這可能是什麼原因造成的?

driver = webdriver.Firefox(firefox_profile=someProfile) 
driver.get(someLink) 

堆棧跟蹤:

Traceback (most recent call last): 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 2885, in run_code 
    exec(code_obj, self.user_global_ns, self.user_ns) 
    File "<ipython-input-2-cdc559ddfda1>", line 1, in <module> 
    driver.get(link) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 245, in get 
    self.execute(Command.GET, {'url': url}) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 231, in execute 
    response = self.command_executor.execute(driver_command, params) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 395, in execute 
    return self._request(command_info[0], url, body=data) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 425, in _request 
    self._conn.request(method, parsed_url.path, body, headers) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 1083, in request 
    self._send_request(method, url, body, headers) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 1128, in _send_request 
    self.endheaders(body) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 1079, in endheaders 
    self._send_output(message_body) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 911, in _send_output 
    self.send(msg) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 854, in send 
    self.connect() 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/http/client.py", line 826, in connect 
    (self.host,self.port), self.timeout, self.source_address) 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/socket.py", line 711, in create_connection 
    raise err 
    File "/home/foo/.conda/envs/myenv3/lib/python3.5/socket.py", line 702, in create_connection 
    sock.connect(sa) 
ConnectionRefusedError: [Errno 111] Connection refused 

回答

0

它的外觀問題涉及到忽略代理設置一些HTTP庫。你使用的是什麼版本的Python?嘗試使用Python 2.x並看看它是如何發展的。