def setvalue(self,viewname,inputcompname,val): self.click_view_title(viewname) self.wait_Tabloading_show_then_hide() btn = ButtonPhonePage(self.driver) btn.click_button('新建') inputtext = InputPhonePage(self.driver,inputcompname) inputtext.set_val(val) btn.click_button('保存') self.wait_msg_show_then_hide() btn.click_button('返回') self.wait_Tabloading_show_then_hide() self.driver.back() self.wait_elem_show_then_hide('.weui_mask_transparent') self.wait_Tabloading_show_then_hide()
def set_val_by_component_type(self, type, comp_name, val): '''根据类型初始化控件并设置控件值''' col_num = '2' if type == 'input': comp = InputPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '2' if type == 'textarea': comp = TextareaPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '3' if type == 'radio': comp = RadioPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '4' if type == 'checkbox': comp = CheckboxPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '5' if type == 'select': comp = SelectPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '6' if type == 'date': comp = DatePhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '7' if type == 'depart': comp = DepartmentPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '8' if type == 'tree_depart': comp = TreeDepartmentPhonePage(self.driver) comp.select_depts(comp_name, [val]) # 输入文本 col_num = '9' if type == 'user': comp = UserSelectPhonePage(self.driver, comp_name) comp.set_val(val) # 输入文本 col_num = '10' if type == 'suggest': comp = SuggestPhonePage(self.driver, (comp_name + '_show')) comp.set_val(val) # 输入文本 col_num = '12' if type == 'reset': comp = ButtonPhonePage(self.driver) comp.click_button('重置') col_num = '3' return col_num