6
votes

Hello i have a simple problem that has suddenly developed on my code, until yesterday it was working correctly, this means it opened a web page and entered login details (is a test for a bigger app), however now whenever it tries to connect to the login page i get a timeout error. I have updated Selenium and Chrome Web Driver to the latest and it is still failing to connect, this is my code:

#importing libraries, selenium is the base of the script, time to add pauses when appropiate or necessary and select and request will stay until i determine that they are not necessary for the final script.
from selenium import webdriver
from selenium.webdriver.support.ui import Select
import time
import requests
#defining browser to use the webdriver with chrome, and navigating to Makor.
browser = webdriver.Chrome()
browser.get('http://mrmprod/Login.aspx')

And this is the complete error code:

Traceback (most recent call last): File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\Scripts\Input test.py", line 7, in browser = webdriver.Chrome() File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in init desired_capabilities=desired_capabilities) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 92, in init self.start_session(desired_capabilities, browser_profile) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 179, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in execute response = self.command_executor.execute(driver_command, params) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 407, in execute return self._request(command_info[0], url, body=data) File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 439, in _request resp = self._conn.getresponse() File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 1197, in getresponse response.begin() File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 297, in begin version, status, reason = self._read_status() File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 258, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 575, in readinto return self._sock.recv_into(b) ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

I asked the network administrator and he has told me that there hasn't being any change on the network settings since i originally got the code working.

1

1 Answers

0
votes

If you have reviewed the aforementioned then do the following steps:

You have to include inside the parenthesis the chromedriver path.

Check the code below:

CODE SAMPLE FOR WINDOWS OS

browser = webdriver.Chrome('C:\\User\\YOUR_USERS_NAME\\YOUR_PATH\\chromedriver.exe')

CODE SAMPLE FOR LINUX OS

browser = webdriver.Chrome('usr\\bin\\YOUR_PATH\\chromedriver')