xiaoshun007 / 12306python Goto Github PK
View Code? Open in Web Editor NEWAn automatic 12306 hacking program by Python. 12306自动抢票程序
An automatic 12306 hacking program by Python. 12306自动抢票程序
成功验证,进入个人中心就不动了
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0
非Python开发人员,报错搞不懂,勉强装好环境。。求大神帮忙!
Mac系统,执行信息如下:
===========hack12306 begin===========
映射出发地、目的地...
加载配置文件...
hack12306.py:41: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
cp.readfp(codecs.open(config_file, "r", "utf-8-sig"))
Traceback (most recent call last):
File "hack12306.py", line 319, in
hackTickets.start()
File "hack12306.py", line 303, in start
self.driver=Browser(driver_name=self.driver_name,executable_path=self.executable_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/splinter/browser.py", line 63, in Browser
return driver(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/splinter/driver/webdriver/chrome.py", line 35, in init
self.driver = Chrome(chrome_options=options, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in init
desired_capabilities=desired_capabilities)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in init
self.start_session(desired_capabilities, browser_profile)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.12.6 x86_64)
非常感谢你的创作,试用了一下,发现有几个小问题:
希望慢慢完善吧
我在这里设置了, self.dtime = '2018-01-12' 但是 在网页上 时间,还是今天,2月6日。来和去地址cookie 都写上了 ,就是这个时间貌似不行
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
1///if self.driver.find_by_text(u"硬座余票0张") == None
这句是不是有问题啊,我明明余票很多,还是自动执行else。(这里应该可以根据config设置的座位来判别,如果是二等座,这个判断就没有意义了)
2///if self.noseat_allow == 0:
self.driver.find_by_id('back_edit_id').click()
这里逻辑希望可以调整,无座,接下来不该是继续刷新查询么、、、
乌鲁木齐 WAR
刷新后不能自动勾选二等座,发现有预定按钮就进去了,还需改进
验证码填的没有问题,但提交由一直显示验证码错误
如果程序里面能设置优先购买学生票,就好了。
另外,有时候刷票人可能离开了,刷成功了也不知道,能加邮件提醒就好了
你好,在win7 64位环境下,使用Python 3.6.1,运行一会后报如下错误
Message: element not visible
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87a
f1),platform=Windows NT 6.1.7601 SP1 x86_64)
(python36env) D:\mrsync\12306Python>[15016:12920:0110/160322.887:ERROR:process_m
etrics.cc(105)] NOT IMPLEMENTED
[15016:12920:0110/160322.887:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[15016:12920:0110/160322.887:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[15016:12920:0110/160322.888:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
程序运行后一直卡在了等待输入验证码 然后去浏览器那看验证码一直刷新不出来
===========hack12306 begin===========
映射出发地、目的地...
加载配置文件...
开始登录...
等待验证码,自行输入...
到这就停了,进行不下去,一直这样,请问是配置错了吗
您好 请问 Mac 浏览器地址如何更改executable_path= ???
一个楼主说的,object has no attribute 'click' 这个问题要增加休息时间,楼主是这个地方吗,我都增加了15s,有的时候还是会崩溃
def confirmSeat(self): # 若提交订单异常,请适当加大sleep的时间 sleep(15) #1
第二个问题:
开始登录...
[0111/103516.261:ERROR:adm_helpers.cc(62)] Failed to query stereo recording.
等待验证码,自行输入...
第三个问:
C:\Users\Administrator\Desktop\火车票\2\12306Python>python hack12306.py
===========hack12306 begin===========
映射出发地、目的地...
加载配置文件...
DevTools listening on ws://127.0.0.1:12714/devtools/browser/de712512-6242-4387-9
bf9-4c4528c9fc09
开始登录...
[0111/103922.049:ERROR:adm_helpers.cc(62)] Failed to query stereo recording.
等待验证码,自行输入...
购票页面开始...
--------->选择的车次类型 GC-高铁/城际
Message: stale element reference: element is not attached to the page document
(Session info: chrome=63.0.3213.3)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87a
f1),platform=Windows NT 6.1.7601 SP1 x86_64)
C:\Users\Administrator\Desktop\火车票\2\12306Python>
设置seat_type的类型反而设置成了tickect_type
比如设置seat_type=软卧,则会默认购买伤残票,因为软卧的value为4,伤残票的value也为4
感谢分享,下面这个问题是因为少了什么?
google了一下,没有类似的信息
Traceback (most recent call last):
File "hack12306.py", line 19, in
from splinter.browser import Browser
ModuleNotFoundError: No module named 'splinter'
错误信息如下,不知道怎么解决:
===========hack12306 begin===========
映射出发地、目的地...
加载配置文件...
Traceback (most recent call last):
File "hack12306.py", line 310, in <module>
hackTickets.start()
File "hack12306.py", line 294, in start
self.driver=Browser(driver_name=self.driver_name,executable_path=self.executable_path)
File "/usr/local/lib/python2.7/site-packages/splinter/browser.py", line 43, in Browser
return driver(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'executable_path'
Message: unknown error: Element ... is not clickable at point (385, 7). Other element would receive the click: ...
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.15063 x86_64)
代码里面好像没看见 最后座位的选项 导致不能自动化提交订单 这个能否修改一下 谢谢~
十分冒昧地打扰你,我很多朋友都让我帮他们抢票,目前正在做一个傻瓜版抢票教程,用Anaconda装环境和依赖,今天发现了你的项目,试了一下,有成功的有失败的,总之想加入这个项目,不知大神是否愿意?
Message: unknown error: Element ... is not clickable at point (370, 7). Other element would receive the click: ...
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 6.1.7601 SP1 x86_64)
D:\gitProject\12306Python>[6636:6140:0116/161524.730:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161524.730:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161524.730:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161524.730:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161724.735:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161724.735:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161724.735:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161724.736:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161924.740:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161924.740:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161924.740:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
[6636:6140:0116/161924.740:ERROR:process_metrics.cc(105)] NOT IMPLEMENTED
`===========hack12306 begin===========
映射出发地、目的地...
加载配置文件...
DevTools listening on ws://127.0.0.1:12975/devtools/browser/187de14c-4671-4195-9bd6-c8a8a3ed4390
[0614/181923.501:ERROR:gl_surface_egl.cc(843)] eglInitialize D3D11 failed with error EGL_NOT_INITIALIZED, trying next display type
开始登录...
[0614/181946.204:ERROR:adm_helpers.cc(73)] Failed to query stereo recording.
等待验证码,自行输入...
购票页面开始...
--------->选择的车次类型 Z-直达
--------->选择的车次类型 K-快速
--------->选择的车次类型 GC-高铁/城际
--------->选择的发车时间 18:00--24:00
循环点击查询... 第 1 次
--------->选择的车次类型 Z-直达
Message: unknown error: Element ... is not clickable at point (542, 204).
Other element would receive the click:
提示信息:
message: element not visible
开始登录...
等待验证码,自行输入...
购票页面开始...
--------->选择的车次类型 GC-高铁/城际
--------->选择的发车时间
未指定发车时间,默认00:00-24:00
循环点击查询... 第 1 次
no elements could be found with text "预订"
还没开始预订
--------->选择的车次类型 GC-高铁/城际
Message: element not visible
明明在默认目录下有个配置文件了,为什么还提示失败?
[orderItem]
order=0
测试了一下,'ElementList' object has no attribute 'click',无法提交订单
刷了一两百次就登不进账号了。。手机电脑都是一致40030操作失败 换个账号就能用
例如买从福田到湘潭北,这两个车站都不在列表中,这时候就需要在12306官网中填上出发地,目的地之后,点击查询,打开F12调试窗口,Network--all--haders--Query String Parameters。显示leftTicketDTO.from_station:NZQ.那么这个NZQ就是出发地福田的代号,leftTicketDTO.to_station:EDQ,同理EDQ就是湘潭北的代号。
我希望能帮助完善该功能
打开火狐后,只停留在主页面,报错Message: Service D:\Program Files (x86)\Firefox\firefox.exe unexpectedly exited. Status code was: 1,请问这个该怎么办
如题,seat_type可否改成支持多种座次类型,像train_types那样
K系列的列车没有选座选项,导致程序多点一次没有成功提交订单
我的ID是zepc007,哈哈哈
请教下我这边Chrome浏览器只有首次会锁定所选车型,第二次就直接跳过不选车型了,直接就是豪华。。。
I tried proxychins4 ,when it lauch brower ,it report an error,and lauched fail;
Hope add an internal proxy config support
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.