def check_channel_option(self, channel_option, select_text): """ :param channel_option:选项的文本信息 :param select_text:下来框的placehodler的属性值 :return: """ select_option(driver=self.driver, select_text=select_text, channel_option=channel_option)
def check_channel(self, option): """ 因为选择频道不是下拉框,而是一种点击选择。所以我们没办法通过下拉拖拽定位来找到对应的选择内容 所以我们封装一个通用的方法遍历这个选择框的所有元素,在utils里封装 """ # self.pub_page.find_channel().click() # self.pub_page.find_channel_option().click() # 调用封装好的获取选择框的方法 select_option(self.driver, "请选择", option)
def check_ari_status(self, status): select_option(DriverUtils.get_mis_driver(), "请选择状态", status)
def check_ar_status(self, status): # 调用公用下拉框选择的函数 select_option(DriverUtils.get_mis_driver(), "请选择状态", status)
def check_target_channel(self, option_name): select_option("请选择", option_name)
# Navigate to starting page: start_url = "https://airquality.gov.wales/maps-data/data-selector/index" driver.delete_all_cookies() print("Running auto_downloader for Welsh data...") for (key, value) in WELSH_PHENOM_DICT.items(): for timechunk in DATES_LIST: print("Searching for {} data for {} to {}...".format( key, timechunk[0], timechunk[1])) driver.get(start_url) # Set options for parameter group and type of data: # "Automatic Monitoring Data" == "4" select_option("f_group_id", "Automatic Monitoring Data", spare_value="4") select_option("action", "Measurement data and simple statistics") # Submit request: click_next('3') # --------------------------------------------------------------------- # Move to next page, select options for phenomenon here: # "phenom" == key (see dictionary) phenom = driver.find_element_by_id("f_parameter_id") select = Select(phenom) select.deselect_all() try: select.select_by_visible_text(key)
def check_channel(self, option): # # 点击频道元素对象 # self.pub_page.find_channel().click() # # 点击选项的元素对象 # self.pub_page.find_ch_option().click() select_option(self.driver, "请选择", option)
def check_target_channel(self, option_name): select_option(DriverUtils.get_mp_driver(), "请选择", option_name)
def query_wait_aduit(self, title, status): select_option(self.driver, "请选择状态", status) self.input_text(self.aduit_page.find_query_box(), title) self.aduit_page.find_end_time().clear() self.aduit_page.find_query_btn().click()
# Navigate to starting page: start_url = "http://www.scottishairquality.scot/data/data-selector" driver.delete_all_cookies() print("Running auto_downloader for Scottish data...") for (key, value) in SCOTTISH_PHENOM_DICT.items(): for timechunk in DATES_LIST: print("Searching for {} data for {} to {}...".format( key, timechunk[0], timechunk[1])) driver.get(start_url) # Set options for parameter group and type of data: # "Automatic Monitoring Data" == "4" select_option("f_group_id", "Automatic Monitoring Data", spare_value="4") # "Measurement data and simple statistics" == "step1" select_option("action", "Measurement data and simple statistics") # Submit request: step1_button = driver.find_element_by_name("go") step1_button.click() # --------------------------------------------------------------------- # Move to next page, select options for phenomenon here: # "phenom" == key (see dictionary) driver.find_element_by_id("f_parameter_id").send_keys(key) step2_button = driver.find_element_by_name("go") step2_button.click()
def check_channel(self, option): # # 下拉框 # self.pub_page.find_channel().click() # # 下拉框选项 # self.pub_page.find_channel_option().click() select_option(self.driver, "请选择", option)
def select_option(self, option): select_option(self.driver, "请选择状态", option)