关于python+selenium+Chrome的一些问题。get报错。请求大佬帮助

#coding=utf8importosfromseleniumimportwebdriverchromedriver="C:\ProgramFiles(x86)\Goo... #coding = utf8
import os
from selenium import webdriver
chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver_x64.exe"
os.environ["webdriver.chrome.driver"]=chromedriver
driver = webdriver.Chrome(chromedriver)
print driver
driver.get("http://baidu.com")#运行到这的时候报错了。。。
print driver.title
browser.quit()
#下面的错误信息:
D:\Python27\python.exe F:/pycharm_code/temp_packge/temp1.py
<selenium.webdriver.chrome.webdriver.WebDriver (session="a3278a2398e547efb0d242d9f5368dc5")>
Traceback (most recent call last):
File "F:/pycharm_code/temp_packge/temp1.py", line 8, in <module>
browser.get("http://baidu.com")
File "D:\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 "D:\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 "D:\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 "D:\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 "D:\Python27\lib\httplib.py", line 1136, in getresponse
response.begin()
File "D:\Python27\lib\httplib.py", line 453, in begin
version, status, reason = self._read_status()
File "D:\Python27\lib\httplib.py", line 409, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "D:\Python27\lib\socket.py", line 480, in readline
data = self._sock.recv(self._rbufsize)
socket.error: [Errno 10054]
展开
 我来答
灰色52056
推荐于2017-11-23 · TA获得超过514个赞
知道小有建树答主
回答量:494
采纳率:100%
帮助的人:355万
展开全部
你试试这样子,这样子我能打开:
#coding = utf8
import os
from selenium import webdriver
chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver_x64.exe"
os.environ["webdriver.chrome.driver"]=chromedriver
driver = webdriver.Chrome()
driver.get("http://baidu.com")#运行到这的时候报错了。。。
print(driver.title)
driver.quit()

还有就是你的seleniu是2.x还是3.x版本?你的chrome是多少版本的?你是否下载了兼容的东东:chromedriver.exe
更多追问追答
追问
还是不行- - 我selenium是3.x版本,chromedriver.exe按照网上教程配置了的。。。按照我那段代码运行后能打开chrome 但是让他进入百度就不行了。运行到get的时候就报错了。。。
追答
不要用3.x!!!你去用2.x,给你我的链接:

http://pan.baidu.com/s/1o7OjHyU
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
Madge奶黄包儿
2018-09-07
知道答主
回答量:3
采纳率:0%
帮助的人:2716
展开全部
请教下 这个问题怎么解决,遇到了同样问题
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式