python调用不起来chrome_python调用selenium打开chrome浏览器失败

问 题

如题,代码如下:

import socket

socket.setdefaulttimeout(20)

chromepath = os.path.abspath(r"C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe")

driver = webdriver.Chrome(chromepath)

driver.get("https://www.baidu.com")

print driver.title

driver.close()

报错如下:

Traceback (most recent call last):

File "C:/Users/CurryXu/Desktop/selenium+phantomjs/experiment/joy.py", line 9, in

driver.get("https://www.baidu.com")

File "C:\Python27\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 248, in get

self.execute(Command.GET, {'url': url})

File "C:\Python27\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 234, in execute

response = self.command_executor.execute(driver_command, params)

File "C:\Python27\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\remote\remote_connection.py", line 407, in execute

return self._request(command_info[0], url, body=data)

File "C:\Python27\lib\site-packages\selenium-3.0.1-py2.7.egg\selenium\webdriver\remote\remote_connection.py", line 439, in _request

resp = self._conn.getresponse()

File "C:\Python27\lib\httplib.py", line 1136, in getresponse

response.begin()

File "C:\Python27\lib\httplib.py", line 453, in begin

version, status, reason = self._read_status()

File "C:\Python27\lib\httplib.py", line 409, in _read_status

line = self.fp.readline(_MAXLINE + 1)

File "C:\Python27\lib\socket.py", line 480, in readline

data = self._sock.recv(self._rbufsize)

socket.error: [Errno 10054]

打开的chrome浏览器显示如下:

请问这是什么原因导致打开浏览器无反应呢

解决方案

扫一扫关注IT屋

微信公众号搜索 “ IT屋 ” ,选择关注与百万开发者在一起

你可能感兴趣的:(python调用不起来chrome_python调用selenium打开chrome浏览器失败)