您的位置:首页 > 编程语言 > Python开发

Python + Splinter 实现自动化登录第一步中遇到的问题

2017-09-05 23:04 483 查看

在这里只是一些遇到的问题,在此备注一下,

Python 与 Splinter 的安装过程就省略了。

chromedriver解决办法:

import splinter.browser import Browser
b = Browser('chrome') #默认是Firefox
b.visit('http:\\www.baidu.com')


#基础使用splinter的代码,可能会遇到以下的错误:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win32\egg\splinter\browser.py", line 63, in Browser
File "build\bdist.win32\egg\splinter\driver\webdriver\chrome.py", line 34, in __init__
File "C:\Python27\lib\site-packages\selenium-3.5.0-py2.7.egg\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Python27\lib\site-packages\selenium-3.5.0-py2.7.egg\selenium\webdriver\common\service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
####selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home


解决办法: 把下载好的chromedriver.exe 放到Python的安装目录下即可解决这个问题,试了一下Path删掉莫得发现什么问题。(咱手机先这样,后续问题接着写。)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python splinter