python splinter 火车票抢购
2016-12-24 19:17
232 查看
今天抢火车票未成功,因此而希望能够找到一个脚本处理火车票订购自动化
引用git上一位朋友写的代码
借用splinter实现浏览器的点击事件
以下只讲借用splinter实现流程
系统 mac MacBook (Retina, 12-inch, Early 2016)
1.安装splinter
2.查看本机是否安装了chromedriver (笔者借用的chrome浏览器)
提示:倘若版本号chromedriver不支持chrome当前版本便会引发以下错误
笔者刚开始图省事然后直接用 brew install chromedriver 安装,结果导致版本号过低,不支持笔者电脑安装的chrome 版本,所以还是建议还是直接下载最新的包,或者选择自己需要的包进行安装
该脚本使用细节可以查看
http://youerning.blog.51cto.com/10513771/1719159/
引用git上一位朋友写的代码
https://github.com/Akagi201/learning-python/blob/master/splinter/huoche.py
借用splinter实现浏览器的点击事件
以下只讲借用splinter实现流程
系统 mac MacBook (Retina, 12-inch, Early 2016)
1.安装splinter
pip installl splinter
2.查看本机是否安装了chromedriver (笔者借用的chrome浏览器)
若没有,打开一下链接 https://chromedriver.storage.googleapis.com/index.html 查看符合自己浏览器版本的chromedriver即刻,笔者使用的chrome版本是55,刚开始看到2.9就点了进去,然后没找到后来发现支持版本55在2.2.7下面, 这里可以查看chromedriver最新版本 https://sites.google.com/a/chromium.org/chromedriver/downloads)
提示:倘若版本号chromedriver不支持chrome当前版本便会引发以下错误
Traceback (most recent call last): File "test.py", line 29, in <module> main() File "test.py", line 11, in main browser = Browser() File "/usr/local/lib/python2.7/site-packages/splinter/browser.py", line 63, in Browser return driver(*args, **kwargs) File "/usr/local/lib/python2.7/site-packages/splinter/driver/webdriver/chrome.py", line 31, in __init__ self.driver = Chrome(chrome_options=options, **kwargs) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__ desired_capabilities=desired_capabilities) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__ self.start_session(desired_capabilities, browser_profile) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session response = self.execute(Command.NEW_SESSION, capabilities) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute response = self.command_executor.execute(driver_command, params) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 408, in execute return self._request(command_info[0], url, body=data) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 440, in _request resp = self._conn.getresponse() File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1136, in getresponse response.begin() File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 453, in begin version, status, reason = self._read_status() File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 417, in _read_status raise BadStatusLine(line) httplib.BadStatusLine: ''
笔者刚开始图省事然后直接用 brew install chromedriver 安装,结果导致版本号过低,不支持笔者电脑安装的chrome 版本,所以还是建议还是直接下载最新的包,或者选择自己需要的包进行安装
该脚本使用细节可以查看
http://youerning.blog.51cto.com/10513771/1719159/
相关文章推荐
- 基于Python3.6+splinter实现自动抢火车票
- Python之——实现自动抢火车票(基于Python3.6+splinter)
- 使用Python和Splinter实现12306火车票查询与抢票
- 使用Python和Splinter实现12306火车票查询与抢票
- 使用Python+Splinter自动刷新抢12306火车票
- splinter python浏览器自动化操作,模拟浏览器的行为
- 用Python抢枪过年的火车票
- splinter python浏览器自动化操作,模拟浏览器的行为
- Python自动化测试工具Splinter简介和使用实例
- 用Python抢枪过年的火车票
- python实现的一个火车票转让信息采集器
- python splinter chromedriver下载地址(国内可用)
- python中splinter环境及subline Text编辑器使用
- 用python抢火车票
- 用Python抢过年的火车票附源码
- python splinter操作chrome时遇到的驱动问题
- 用Python抢过年的火车票附源码
- Python的Web应用验收测试 Splinter
- Splinter - Python的Web应用程序验收测试工具