Reputation: 21
I'm using selenium - chrome for scraping pages and sometimes I get such an errors while getting website:
http.client.RemoteDisconnected: Remote end closed connection without response
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=40097): Max retries exceeded with url: /session/503e38e9827bff7335d467e8ba31cb5c/screenshot (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))
I tried with page strategy and different chrome options like:
options.page_load_strategy = 'eager'
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--disable-gpu')
options.add_argument('--enable-features=NetworkServiceInProcess')
options.add_argument('--disable-features=NetworkService')
Nothing eliminate my errors.
I'm using such chrome and chrome driver version in container:
Can you help me solve this problem?
Upvotes: 2
Views: 5940
Reputation: 80
This is probably not a problem caused by you, but a problem caused by the website you are trying to visit.
As you showed in your stacktrace above the error you receive is a Connection aborted
or Remote Disconnected
error, which means, the connection breaks or was not even created.
The aborted / refused exception does usually occur, when one side of a connection closes the socket unexpectedly.
There is not really something you can do about except to verify if its not your internet connection, that is causing that problem.
This is not a python or selenium error.
Upvotes: 2