def add_member(self, username, acctid, phone): self.find(By.ID, 'username').send_keys(username) self.find(By.ID, 'memberAdd_acctid').send_keys(acctid) self.find(By.ID, 'memberAdd_phone').send_keys(phone) self.find(By.CSS_SELECTOR, '.js_btn_save').click() sleep(3) return ContactPage(self.driver)
def goto_contact_page(self): """ 从导航栏进入通讯录页面 :return: """ contact_btn = (By.CSS_SELECTOR, ".frame_nav_item:nth-child(2)") self.click_action(contact_btn) return ContactPage()
def add_memeber(self, name: list, *args): """ 获取所有成员的姓名 :param name: 每个元素的别名,便于识别 :param args: 需要替换yml文件中值 :return: """ self._params['value'] = args self.steps('../page/add_member.yml', name) return ContactPage()
class TestAddDepart: def setup_class(self): self.contact = ContactPage() @pytest.mark.parametrize("name", ["四级部门"]) def test_add_department(self, name): """ 用来测试添加成员功能 :return: """ # 1. 跳转到添加成员页面 2. 添加成员 3. 获取成员列表,做断言验证 # AddMemberPage() # res = self.main.goto_add_department().add_member(name).get_list() res = self.contact.goto_add_department().add_depart(name).get_list() assert name in res
def goto_contacts(self, name: list): """ 跳转到联系人页面 :param name: 每个元素的别名,便于识别 :return: """ self.steps('../page/common.yml', name) return ContactPage() # def goto_member_join(self): # self.steps('../page/main.yml', ['成员加入']) # return MemeberJoin() # # def goto_mass_news(self): # self.steps('../page/main.yml', ['消息群发']) # return MassNews() # # def goto_customer_contact(self): # self.steps('../page/main.yml', ['客户联系']) # return CustomerContact() # # def goto_clock_in(self): # self.steps('../page/main.yml', ['打卡']) # return ClockIn()
def add_contact(driver, name, email, phone, is_star, remark, assert_text): home_page = HomePage(driver) home_page.click_contact_button() contact_page = ContactPage(driver) contact_page.click_contact_creat_button() contact_page.input_name(name) contact_page.input_email(email) contact_page.input_phone(phone) contact_page.input_remark(remark) if is_star == "是": contact_page.click_star_button() contact_page.click_confirm_button() time.sleep(2) assert_word(driver, assert_text)
def contactpage(self): return ContactPage(self.driver)
def had_login(init_login_pages): login_page = init_login_pages login_page.login(userName, passWord) contact_page = ContactPage(login_page.driver) yield contact_page login_page.del_cookies
def goto_contact(self): self.find_and_click('id', 'menu_contacts') return ContactPage(self.driver)
def goto_contact(self): self.driver.find_element(By.XPATH, '//*[@id="menu_contacts"]/span').click() return ContactPage(self.driver)
def setup_class(self): self.contact = ContactPage()