爬虫工具之selenium(二)

241次阅读
没有评论

进行代码调试时:

from selenium import webdriver c=webdriver.Chrome(executable_path=r'C:\Program Files\Google\Chrome\Application\chrome.exe') #获取chrome浏览器的驱动,并启动Chrome浏览器 c.get('https://www.baidu.com')#打开百度 print('成功')

出现错误信息:
爬虫工具之selenium(二)
只能打开chrome浏览器,但无法打开指定的网址

1.检查host文件中是否包含“127.0.0.1 localhost”
爬虫工具之selenium(二)
将#去掉

2.ping localhost看是否连通(不连通的话考虑关闭防火墙)
参考python版selenium浏览器驱动问题Can not connect to the Service chromedriver解决
爬虫工具之selenium(二)

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:Python教程2022-10-24发表,共计397字。
新手QQ群:570568346,欢迎进群讨论 Python51学习