Giter Club home page Giter Club logo

12306python's People

Contributors

lonycc avatar xiaoshun007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

12306python's Issues

没执行成功,好像驱动的问题?

非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)

我还没成功过,一直碰到这两个bug

一个楼主说的,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>

选座位靠窗 过道 问题

代码里面好像没看见 最后座位的选项 导致不能自动化提交订单 这个能否修改一下 谢谢~

登录刷新预定页面,第一次进入提示超时,导致预定element not visible

开始登录...
等待验证码,自行输入...
购票页面开始...
--------->选择的车次类型 GC-高铁/城际
--------->选择的发车时间
未指定发车时间,默认00:00-24:00
循环点击查询... 第 1 次
no elements could be found with text "预订"
还没开始预订
--------->选择的车次类型 GC-高铁/城际
Message: element not visible

关于学生票,邮件提醒等

如果程序里面能设置优先购买学生票,就好了。
另外,有时候刷票人可能离开了,刷成功了也不知道,能加邮件提醒就好了

Message: unknown error

`===========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:


(Session info: chrome=66.0.3359.181)
(Driver info: chromedriver=2.36.540470 (e522d04694c7ebea4ba8821272dbef4f9b818c91),platform=Windows NT 6.1.7601 SP1 x86_64)`

Mac executable_path 相关错误

错误信息如下,不知道怎么解决:

===========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'

无法提交订单

测试了一下,'ElementList' object has no attribute 'click',无法提交订单

测试了一下,先提一几小问题

非常感谢你的创作,试用了一下,发现有几个小问题:

  1. 车次没有全选,没有K字头的火车,春运有个K字头也比较幸福啦
    2,查询过程中,12306只要出现对话框,程序就中止了。

希望慢慢完善吧

你好,我想加入这个项目,可以吗

十分冒昧地打扰你,我很多朋友都让我帮他们抢票,目前正在做一个傻瓜版抢票教程,用Anaconda装环境和依赖,今天发现了你的项目,试了一下,有成功的有失败的,总之想加入这个项目,不知大神是否愿意?

ModuleNotFoundError: No module named 'splinter'

感谢分享,下面这个问题是因为少了什么?
google了一下,没有类似的信息

Traceback (most recent call last):
File "hack12306.py", line 19, in
from splinter.browser import Browser
ModuleNotFoundError: No module named 'splinter'

seat_type与票类型的value错位了

设置seat_type的类型反而设置成了tickect_type
比如设置seat_type=软卧,则会默认购买伤残票,因为软卧的value为4,伤残票的value也为4

调用浏览器出错

打开火狐后,只停留在主页面,报错Message: Service D:\Program Files (x86)\Firefox\firefox.exe unexpectedly exited. Status code was: 1,请问这个该怎么办

选座问题

K系列的列车没有选座选项,导致程序多点一次没有成功提交订单

请问这个未实现是什么意思

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

关于无座的问题

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()
这里逻辑希望可以调整,无座,接下来不该是继续刷新查询么、、、

Message: element not visible 错误

你好,在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

车型锁定问题

请教下我这边Chrome浏览器只有首次会锁定所选车型,第二次就直接跳过不选车型了,直接就是豪华。。。

时间貌似有点问题

我在这里设置了, self.dtime = '2018-01-12' 但是 在网页上 时间,还是今天,2月6日。来和去地址cookie 都写上了 ,就是这个时间貌似不行

停在了等待验证码

===========hack12306 begin===========
映射出发地、目的地...
加载配置文件...
开始登录...
等待验证码,自行输入...

到这就停了,进行不下去,一直这样,请问是配置错了吗

车次怎么制定 说的有点模糊

order:车次,选择第几趟,0则从上至下依次点击,必选参数,如果要特定车次,需要先找到车次在列表中的次序,有效值如下:

0->从上至下点击

1->第一个车次

2->第二个车次

[orderItem]
order=0

关于车站名不在列表中的问题

例如买从福田到湘潭北,这两个车站都不在列表中,这时候就需要在12306官网中填上出发地,目的地之后,点击查询,打开F12调试窗口,Network--all--haders--Query String Parameters。显示leftTicketDTO.from_station:NZQ.那么这个NZQ就是出发地福田的代号,leftTicketDTO.to_station:EDQ,同理EDQ就是湘潭北的代号。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.