def select_depts(self, compname, lis): '''开始选择部门''' self.go_to_depts(compname) for li in lis: self.find_elem_is_clickable( 'li[data-name="' + li + '"]>div.wtree-deptlist-box>input.wtree-deptlist-input').click( ) bt = ButtonPhonePage(self.driver) bt.click_iframe_button('保存') self.driver.switch_to.default_content()
def test_close_button(self): '''树形部门取消按钮''' compname = '树形部门选择框_点击退出' comp = TreeDepartmentPhonePage(self.driver) target = comp.get_dept(compname) comp.scroll_to_target_element(target) comp.select_depts(compname, ['产品部', '测试部']) self.assertEqual('产品部;测试部', comp.get_select_depts(compname), msg=compname + '检验不通过') comp.select_depts_no_save(compname, ['产品部']) bt = ButtonPhonePage(self.driver) bt.click_iframe_button('取消') self.driver.switch_to.default_content() self.assertEqual('产品部;测试部', comp.get_select_depts(compname), msg=compname + '检验不通过')
def test_clean_button(self): '''选择部门后清除数据''' compname = '树形部门选择框_点击清除' comp = TreeDepartmentPhonePage(self.driver) target = comp.get_dept(compname) comp.scroll_to_target_element(target) comp.select_depts(compname, ['产品部', '测试部']) self.assertEqual('产品部;测试部', comp.get_select_depts(compname), msg=compname + '检验不通过') comp.go_to_depts(compname) bt = ButtonPhonePage(self.driver) bt.click_iframe_button('清除') bt.click_iframe_button('保存') self.driver.switch_to.default_content() self.assertEqual('', comp.get_select_depts(compname), msg=compname + '检验不通过')