2015-10-07 19 views
6

Test sayfasından çıkış yapmayı deniyorum, ancak driver.find_element_by_xpath ("// a [@href = '/ login/pages") olduğunda bağlantı reddi hatası var /user/logout.php '] ") click() Ayrıca, linktext veya ActionChains, aynı hata ile denedim. Ve bazen olur, her zaman değil, Herhangi bir yorum?urlopen error [Errno 111] Bağlantı, selenyum pythonu için reddedildi

Hata Mesajı

<urlopen error [Errno 111] Connection refused> 
Stacktrace 

Traceback (most recent call last): 
    File "/home/jenkins/run/workspace/QA_DEV_CINDY_LOGGED/LoggedSmoke/LoggedCommonFunction.py", line 158, in Logout 
    link.click() 
    File "/usr/local/lib/python3.3/site-packages/selenium/webdriver/remote/webelement.py", line 70, in click 
    self._execute(Command.CLICK_ELEMENT) 
    File "/usr/local/lib/python3.3/site-packages/selenium/webdriver/remote/webelement.py", line 404, in _execute 
    return self._parent.execute(command, params) 
    File "/usr/local/lib/python3.3/site-packages/selenium/webdriver/remote/webdriver.py", line 193, in execute 
    response = self.command_executor.execute(driver_command, params) 
    File "/usr/local/lib/python3.3/site-packages/selenium/webdriver/remote/remote_connection.py", line 358, in execute 
    return self._request(command_info[0], url, body=data) 
    File "/usr/local/lib/python3.3/site-packages/selenium/webdriver/remote/remote_connection.py", line 426, in _request 
    resp = opener.open(request) 
    File "/usr/local/lib/python3.3/urllib/request.py", line 469, in open 
    response = self._open(req, data) 
    File "/usr/local/lib/python3.3/urllib/request.py", line 487, in _open 
    '_open', req) 
    File "/usr/local/lib/python3.3/urllib/request.py", line 447, in _call_chain 
    result = func(*args) 
    File "/usr/local/lib/python3.3/urllib/request.py", line 1274, in http_open 
    return self.do_open(http.client.HTTPConnection, req) 
    File "/usr/local/lib/python3.3/urllib/request.py", line 1253, in do_open 
    r = h.getresponse() 
    File "/usr/local/lib/python3.3/http/client.py", line 1147, in getresponse 
    response.begin() 
    File "/usr/local/lib/python3.3/http/client.py", line 358, in begin 
    version, status, reason = self._read_status() 
    File "/usr/local/lib/python3.3/http/client.py", line 328, in _read_status 
    raise BadStatusLine(line) 
http.client.BadStatusLine: '' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "/usr/local/lib/python3.3/urllib/request.py", line 1248, in do_open 
    h.request(req.get_method(), req.selector, req.data, headers) 
    File "/usr/local/lib/python3.3/http/client.py", line 1065, in request 
    self._send_request(method, url, body, headers) 
    File "/usr/local/lib/python3.3/http/client.py", line 1103, in _send_request 
    self.endheaders(body) 
    File "/usr/local/lib/python3.3/http/client.py", line 1061, in endheaders 
    self._send_output(message_body) 
    File "/usr/local/lib/python3.3/http/client.py", line 906, in _send_output 
    self.send(msg) 
    File "/usr/local/lib/python3.3/http/client.py", line 844, in send 
    self.connect() 
    File "/usr/local/lib/python3.3/http/client.py", line 822, in connect 
    self.timeout, self.source_address) 
    File "/usr/local/lib/python3.3/socket.py", line 435, in create_connection 
    raise err 
    File "/usr/local/lib/python3.3/socket.py", line 426, in create_connection 
    sock.connect(sa) 
ConnectionRefusedError: [Errno 111] Connection refused 

cevap

0

Bu Selenyum dili bağları ve Selenyum sunucusuna arasında geçici bağlantı konudur. Bu, farklı bir makinede uzak bir Selenium sunucusu kullanıyorsanız ve özellikle de internet üzerinden geçiyorsa daha sık gerçekleşebilir. Örneğin, BrowserStack veya Sauce Labs'daki uzak selenyum sunucularını kullanırken bu tür hataları gördük.

Python/Selenium bağlamaları, JSON wire (JSON over HTTP) isteklerini/komutlarını yeniden denemenin otomatik bir yolu olmadığından, kodunuzda işlemek zorunda kalırsınız. Örneğin, bu testler çalıştırıyorsanız, bu hataların üstesinden gelmek için ortak bir yol yeniden deneme başarısız testi 3 kez ve yalnızca 3 girişimin tümü başarısız olursa başarısız bir testi rapor et.

İlgili konular