def query_condition(self, condition): # 选择查询条件,点击【搜索】 # index:第一个查询条件的下拉框内容下标, second:第二个下拉框条件的时间或者文本 iframe = UiUtil.find_element('query_order', 'iframe') self.driver.switch_to.frame(iframe) query_element = UiUtil.find_element('query_order', 'query_element') Select(query_element).select_by_visible_text(condition[0]) # 第一个查询条件框,用下拉框内容下标取值 if '时间' in condition[0] : # 选择第一种查询条件【按时间查询】 query_time_element = self.driver.find_element_by_id('time') UiUtil.input_select('time', query_time_element, condition[1]) # 第二个下拉框输入日期 else: # 选择第二种查询条件【按状态查询】 query_status_element = UiUtil.find_element('query_order', 'query_status_element') Select(query_status_element).select_by_visible_text(condition[1]) # 第二个下拉框选择文本 UiUtil.find_element('query_order', 'query_button').click() # 点击搜索按钮
def order_history(self): # 进入历史订单界面 history_button = UiUtil.find_element('query_order', 'history_button') UiUtil.click(history_button)
def __init__(self, driver): # self.driver = driver self.driver = UiUtil.get_driver1()
history_button = UiUtil.find_element('query_order', 'history_button') UiUtil.click(history_button) def query_condition(self, condition): # 选择查询条件,点击【搜索】 # index:第一个查询条件的下拉框内容下标, second:第二个下拉框条件的时间或者文本 iframe = UiUtil.find_element('query_order', 'iframe') self.driver.switch_to.frame(iframe) query_element = UiUtil.find_element('query_order', 'query_element') Select(query_element).select_by_visible_text(condition[0]) # 第一个查询条件框,用下拉框内容下标取值 if '时间' in condition[0] : # 选择第一种查询条件【按时间查询】 query_time_element = self.driver.find_element_by_id('time') UiUtil.input_select('time', query_time_element, condition[1]) # 第二个下拉框输入日期 else: # 选择第二种查询条件【按状态查询】 query_status_element = UiUtil.find_element('query_order', 'query_status_element') Select(query_status_element).select_by_visible_text(condition[1]) # 第二个下拉框选择文本 UiUtil.find_element('query_order', 'query_button').click() # 点击搜索按钮 def do_query_condition(self, condition): self.order_history() self.query_condition(condition) if __name__ == '__main__': driver = UiUtil.get_driver() login_data = {'username': '******', 'password': '******', 'verifycode': '0000'} Login(driver).do_login(login_data) condition = ['按状态查询', '进行中'] QuaryOrder(driver).do_query_condition(condition)
def click_mine(self): mine_button = UiUtil.find_element('change_mine_info', 'mine_button') UiUtil.click(mine_button) # 点击主页【我的】按钮
def click_change_personal_info(self, mine_info): iframe = UiUtil.find_element('change_mine_info', 'iframe') self.driver.switch_to.frame(iframe) # 切换iframe time.sleep(2) info_button = UiUtil.find_element('change_mine_info', 'info_button') UiUtil.click(info_button) # 点击【更改个人信息】按钮 time.sleep(2) phone = UiUtil.find_element('change_mine_info', 'phone') UiUtil.input(phone, mine_info['phone']) # 输入【用户电话】 nickname = UiUtil.find_element('change_mine_info', 'nickname') UiUtil.input(nickname, mine_info['name']) # 输入用户昵称 sex = UiUtil.find_element('change_mine_info', 'sex') UiUtil.input(sex, mine_info['sex']) # 输入用户性别 0=女 1=男 submit_button = UiUtil.find_element('change_mine_info', 'submit_button') UiUtil.click(submit_button)
def click_add_carport(self): # 点击添加车位 iframe = UiUtil.find_element('add_carport', 'iframe') # 这里需要切换一次iframe self.driver.switch_to.frame(iframe) add_carport = UiUtil.find_element('add_carport', 'add') UiUtil.click(add_carport)
def click_add(self): # 输完内容之后点击增加按钮 add_button = UiUtil.find_element('add_carport', 'add_button') UiUtil.click(add_button)
def input_location(self, value): # 输入详细地址 location = UiUtil.find_element('add_carport', 'location') UiUtil.input(location, value)
def input_location_id(self, value): # 输入位置id location_id = UiUtil.find_element('add_carport', 'location_id') UiUtil.input(location_id, value)
def input_car_id(self, value): # 输入车位号 car_id = UiUtil.find_element('add_carport', 'car_id') UiUtil.input(car_id, value)