joyzoursky / docker-python-chromedriver

Dockerfile for running Python Selenium in headless Chrome (Python 2.7 / 3.6 / 3.7 / 3.8 / Alpine based Python / Chromedriver / Selenium / Xvfb included in different versions)
https://hub.docker.com/r/joyzoursky/python-chromedriver/
MIT License
636 stars 196 forks source link

Random failures when using pytest -N x #5

Closed igladun closed 5 years ago

igladun commented 5 years ago

Hello, When I am running my tests in parallel mode, using pytest -N 2 (or more), often I get such exception:

============================= test session starts ============================= platform linux -- Python 3.6.4, pytest-3.8.0, py-1.6.0, pluggy-0.7.1 rootdir: /home/docker/code, inifile: plugins: xdist-1.23.0, forked-0.2 gw0 I / gw1 I gw0 [6] / gw1 [6]

scheduling tests via LoadScheduling F..... [100%] =================================== FAILURES =================================== ____ GoogleTest.test_search ____ [gw0] linux -- Python 3.6.4 /usr/local/bin/python

self =

def setUp(self):
  super(GoogleTest, self).setUp()

test/test_smoke.py:8:


test/base_test.py:10: in setUp self.driver = webdriver.Chrome(chrome_options=options) /usr/local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py:75: in init desired_capabilities=desired_capabilities) /usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:156: in init self.start_session(capabilities, browser_profile) /usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:251: in start_session response = self.execute(Command.NEW_SESSION, parameters) /usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py:318: in execute response = self.command_executor.execute(driver_command, params) /usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py:375: in execute return self._request(command_info[0], url, body=data) /usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/remote_connection.py:397: in _request resp = self._conn.request(method, url, body=body, headers=headers) /usr/local/lib/python3.6/site-packages/urllib3/request.py:72: in request urlopen_kw) /usr/local/lib/python3.6/site-packages/urllib3/request.py:150: in request_encode_body return self.urlopen(method, url, extra_kw) /usr/local/lib/python3.6/site-packages/urllib3/poolmanager.py:322: in urlopen response = conn.urlopen(method, u.request_uri, **kw) /usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py:638: in urlopen _stacktrace=sys.exc_info()[2]) /usr/local/lib/python3.6/site-packages/urllib3/util/retry.py:367: in increment raise six.reraise(type(error), error, _stacktrace) /usr/local/lib/python3.6/site-packages/urllib3/packages/six.py:685: in reraise raise value.with_traceback(tb) /usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py:600: in urlopen chunked=chunked) /usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py:384: in _make_request six.raise_from(e, None)

:2: in raise_from ??? /usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py:380: in _make_request httplib_response = conn.getresponse() /usr/local/lib/python3.6/http/client.py:1331: in getresponse response.begin() /usr/local/lib/python3.6/http/client.py:297: in begin version, status, reason = self._read_status() /usr/local/lib/python3.6/http/client.py:258: in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = b = def readinto(self, b): """Read up to len(b) bytes into the writable buffer *b* and return the number of bytes read. If the socket is non-blocking and no bytes are available, None is returned. If *b* is non-empty, a 0 return value indicates that the connection was shutdown at the other end. """ self._checkClosed() self._checkReadable() if self._timeout_occurred: raise OSError("cannot read from timed out object") while True: try: > return self._sock.recv_into(b) E urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) /usr/local/lib/python3.6/socket.py:586: ProtocolError ===================== 1 failed, 5 passed in 24.40 seconds ====================== Image: 3.6-xvfb-selenium pytest==3.8.0 pytest-forked==0.2 pytest-xdist==1.23.0
igladun commented 5 years ago

Downgrade to selenium==3.8.0 resolved the issue