2016-11-16 132 views
0

我硒工作,Firefox和IE浏览器,但我无法得到与镀铬工作尚未:S的Python 3.5硒的webdriver铬

这是我的代码(简单只是为了检查):

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

问题是,Chrome浏览器打开窗户,但被卡住后,不会不要去的网页,我收到此错误:

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

的问题是,我没有任何其他的连接打开:S和当它打开ch在页面的顶部罗马窗口,我收到这样的:

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

我真的认为,这是导致不能正常工作的硒,但我没有得到它的权利!一些帮助请求?!?!?!?!

回答

1

尝试使用下面的代码,让我知道在任何问题时:

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') 
+0

感谢这么这么多:d它的工作原理:d –