Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
自动环路&;Python中的代码执行步骤_Python_Selenium - Fatal编程技术网

自动环路&;Python中的代码执行步骤

自动环路&;Python中的代码执行步骤,python,selenium,Python,Selenium,我是Python的初学者。我几乎完成了我的预订自动化,但我正在努力与循环 基本上,预订将在18:00打开,但我需要浏览器。get url将保持刷新,直到预订打开,它可以执行以下XX段代码 browser.get('https://') while False:( have just put this false in to show what im trying or on the right path, or not!!!) browser. Refresh() XX = Select(br

我是Python的初学者。我几乎完成了我的预订自动化,但我正在努力与循环

基本上,预订将在18:00打开,但我需要浏览器。get url将保持刷新,直到预订打开,它可以执行以下XX段代码

browser.get('https://')
while False:( have just put this false in to show what im trying or on the right path, or not!!!)
browser. Refresh()

XX = Select(browser.find_element_by_xpath(".//*[@id='booking_form_1']"))
XX.select_by_index(1)
XX.select_by_visible_text('XXXXXX')
最简单的方法是什么?

browser.get('https://'))
预订是否打开=错误
虽然没有预订,但仍然开放:
浏览器刷新()
XX=Select(browser.find_element_by_xpath(“./*[@id='booking_form_1']))
二十、 按索引选择索引(1)
二十、 通过可视文本(“XXXXXX”)选择
is_booking_open=get_open_msg()#返回True或False;您需要确定是否存在未打开的弹出窗口,selenium可以这样做
browser.get('https://'))
预订是否打开=错误
虽然没有预订,但仍然开放:
浏览器刷新()
XX=Select(browser.find_element_by_xpath(“./*[@id='booking_form_1']))
二十、 按索引选择索引(1)
二十、 通过可视文本(“XXXXXX”)选择
is_booking_open=get_open_msg()#返回True或False;您需要确定是否存在未打开的弹出窗口,selenium可以这样做

当预订开始时,您能收到打开信息吗?那你就可以停止循环了,对吗?例如,
booking\u open=False,而不是booking\u open:loop。。。在booking_open=XX.get_booking_msg()#return True
之前,循环将停止。我会看到一个弹出屏幕,上面显示时间不可用,您无法预订所选时间。请选择另一个,但我的pycharm日志中的错误显示如下:回溯(最近一次调用上次):文件“C xx=select(browser.find_element_by_xpath(“./*[@id='booking_player_1']”)文件”C:\pycharm项目\1stPython\venv\lib\site packages\selenium\webdriver\remote\webdriver.py“,第394行,在find_element_by_xpath返回self.find_element(by=by.xpath,value=xpath)文件“C:\\PycharmProjects\1stPython\venv\lib\site packages\selenium\webdriver\remote\webdriver.py”,第976行,在find_element返回self.execute(Command.find_element,{File“执行self.error\u handler.check\u response(response)文件”C:\PycharmProjects\1stPython\venv\lib\site packages\selenium\webdriver\remote\webdriver.py”中的第321行,在check\u response引发异常类(消息、屏幕、堆栈跟踪)中selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法定位元素:{“方法”:“xpath”,“选择器”:“/*[@id='booking\u player_1']”当预订打开时,您可以收到打开消息吗?然后您可以停止循环,对吗?例如,
booking\u open=False,而不是booking\u open:loop…直到booking\u open=XX.get\u booking\u msg()#return True
,则循环将停止。我会弹出一个屏幕,显示时间不可用,您无法预订所选时间。请选择其他时间,但我的pycharm日志中的错误显示如下:回溯(最近一次调用):File“C xx=select(browser.find_element_by_xpath(./*[@id='booking_player_1'])File“C:\PycharmProjects\1stPython\venv\lib\site packages\selenium\webdriver\remote\webdriver.py”,第394行,按xpath返回self.find_元素(by=by.xpath,value=xpath)文件“C:\\PycharmProjects\1stPython\venv\lib\site packages\selenium\webdriver\remote\webdriver.py”,第976行,find_元素返回self.execute.execute(Command.FIND_元素,{File“\PycharmProjects\1stPython\venv\lib\site packages\selenium\webdriver\remote\webdriver.py”,第321行,在execute self.error\u handler.check_响应(response)文件“C:\PycharmProjects\1stPython\venv\lib\site packages\selenium\webdriver\remote\errorhandler.py”,第242行,在check_响应引发异常类中(message,screen,stacktrace)selenium.common.exceptions.NoSuchElementException:message:没有这样的元素:找不到元素:{“method”:“xpath”,“selector”:“/*[@id='booking\u player\u 1']”非常感谢,selenium如何确定弹出窗口是否与此函数类似
通过\u xpath(./*[@id='booking\u form\u 1'])
,当弹出时,必须有一些可以获取的HTML元素,例如
,非常感谢,selenium如何确定弹出是否与此函数类似
通过xpath(“./*[@id='booking_form_1']”)查找元素
,当弹出时,必须有一些可以获取的HTML元素,例如