def login(account, password, action: ElementActions): time.sleep(5) # action.driver.find_element_by_id('com.shautolinked.car:id/btnLeft').click() action.text(LoginPage.用户名, account, clear_first=True) action.text(LoginPage.密码, password, clear_first=True) action.sleep(1) action.click(LoginPage.登录)
def test_login(self, action: ElementActions): L.d('test_login') account = Steps.get_account() action.click(HomePage.登录入口) action.text(LoginPage.账户, account[0]) action.text(LoginPage.密码, account[1]) action.sleep(1) action.click(LoginPage.登录) assert action.is_toast_show('欢迎回来')
def test_comment(self, action: ElementActions): action.sleep(1) action.click(HomePage.评论按钮) action.sleep(1) action.click(CommentPage.评论框打开) action.text(CommentPage.评论框输入, 'nice') action.click(CommentPage.评论发送) action.sleep(1) assert action.is_text_displayed('nice')
def test_rrtv_login(self, action: ElementActions): L.d('rrtv login') account = Steps.get_account() action.click(MyPage.我的) action.click(MyPage.头像) action.click(LoginPage.账号密码登录) action.text(LoginPage.账户, account[0]) action.back_press() action.text(LoginPage.密码, account[1]) action.back_press() action.click(LoginPage.登录) assert action.is_text_displayed("test")
def test_login(self, action: ElementActions): L.d('test_login') allure.attach('描述', '这是一个登陆的case') account = Steps.get_account() action.sleep(3) # action.test_SwipeGuideImages() action.click(HomePage.登录入口) action.text(LoginPage.账户, account[0]) action.text(LoginPage.密码, account[1]) action.sleep(1) action.click(LoginPage.登录) action.sleep(3) assert action._find_text_in_page("我的")
def test_home(self, action: ElementActions): # up.登录页.login(action,'13550234762','tmhrush2233') action.click(p.特卖首页.搜索输入框) #因为调用action的大部分公用方法是返回self,所以可以一条语句执行多次不同方法 action.text(p.分类列表搜索页.搜索输入框,"口红")\ .click(p.分类列表搜索页.搜索按钮) action.click(p.搜索后列表页.第一个商品项) #循环下拉,检查是否有对应关键字,找到后终止 for count in range(20): if action.swip_down().is_text_displayed("商品参数"): break #没有对应关键字抛出错误 if action.is_text_displayed("口红") == False: raise NotFoundTextError action.sleep(1)
def test_login(self, action: ElementActions): L.d('test_login') """ 检查是否在登录状态,在登陆的话就退出登录再登录 """ action.click(HomePage.我的) if action.is_text_displayed('like'): action.click(MyPage.设置) action.click(SettingPage.登出) action.click(SettingPage.确定) action.click(HomePage.我的) else: pass action.click(HomePage.登陆按钮) action.sleep(1) action.text(LoginPage.手机号, '96522075359') action.click(LoginPage.获取验证码) action.sleep(1) action.text(LoginPage.密码, '2333') action.sleep(0.5) action.click(LoginPage.登陆) assert action.get_text(MyPage.名字) == 'kirua'
def login(self, action: ElementActions, account, password): self.switch_密码登录tag(action) action.text(self.账号输入框, account).text(self.密码输入框, password).click(self.登录按钮) action.sleep(5)
def pageinto(self, action: ElementActions, key="专场"): categorylistpage = CategoryListPage() categorylistpage.pageinto(action) action.text(categorylistpage.搜索输入框, key).click(categorylistpage.搜索按钮)