Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,这个程序为什么刷新到90次左右的时候就会终止? #32

Open
Allen-Liang opened this issue Jan 23, 2018 · 1 comment

Comments

@Allen-Liang
Copy link

提示信息:
message: element not visible

@timegambler
Copy link

timegambler commented Dec 13, 2019

是因为查询按钮需要一定的时间才能渲染出现,通信过程中出现阻塞导致该按钮没有渲染出现,
建议使用try进行规避,避免因为阻塞造成抢票变慢,相关函数:specifyTrainNo
修改替换(有些乱):

def specifyTrainNo(self):

    <code>

    def specifyTrainNo(self):
        count=0
        while self.driver.url == self.ticket_url:
        # 勾选车次类型,发车时间
            self.searchMore();
            sleep(0.05)
            try:
                self.driver.find_by_text(u"查询").click()
            except Exception as e:
                print(e)
                print('未加载成功,重新循环')
                continue
            count += 1
            print(u"循环点击查询... 第 %s 次" % count)
            try:
                self.driver.find_by_text(u"预订")[self.order - 1].click()
                sleep(0.3)
            except Exception as e:
                print(e)
                print(u"还没开始预订")
                continue `

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants