0
votes

I got selenium work with Firefox and IE but I can't get work with Chrome yet :S

this is my code (simple just to check):

from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://www.google.com')

The problem is that Chrome open the window but after get stuck, doesn't neither go to the webpage and I receive this error:

Traceback (most recent call last): File "C:/Users/Carlo/Desktop/CEx/src/IE.py", line 21, in driver.get('https://www.google.com') File "C:\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 248, in get self.execute(Command.GET, {'url': url}) File "C:\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 234, in execute response = self.command_executor.execute(driver_command, params) File "C:\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:\Python35-32\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 439, in _request resp = self._conn.getresponse() File "C:\Python35-32\lib\http\client.py", line 1197, in getresponse response.begin() File "C:\Python35-32\lib\http\client.py", line 297, in begin version, status, reason = self._read_status() File "C:\Python35-32\lib\http\client.py", line 258, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "C:\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

The problem is that I don't have any other connection open :S and when it open the chrome window on the top of the page I receive this:

You are using an unsupported command-line flag: --ignore-certificate-errors. Stability and security will suffer.

I really believe that this is causing the not working of selenium but I'm not getting it right! some help pls?!?!?!?!

1

1 Answers

1
votes

Try to use following code and let me know in case of any issues:

from selenium import webdriver

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("test-type")
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('https://www.google.com')