Exemplo n.º 1
0
    def config_4(self):
        log.info("点击密码按键,进入账号密码登录页面")
        self.dr.find_element_by_accessibility_id("请输入QQ号码或手机或邮箱").clear()
        sleep(4)
        for i in config_1.read_data():
            self.dr.find_element_by_accessibility_id(
                "请输入QQ号码或手机或邮箱").send_keys(i[0])
            sleep(2)
            log.info(f"输入的手机号是:{i[0]}")
            self.dr.find_element_by_id(
                "com.tencent.tim:id/password").send_keys(i[1])
            sleep(2)
            log.info(f"输入的手机号是:{i[1]}")
            self.dr.find_element_by_id("com.tencent.tim:id/login").click()
            log.info("点击登录按钮")
            sleep(6)
            """
            if  else 处理登录成功与失败,也可以使用try except语句做断言

            """
            try:
                log.info("登录失败的处理......")
                b = self.dr.find_element_by_id(
                    "com.qk.butterfly:id/tv_to_login").text
                print("登录失败")
                self.assertEqual(b, "登录", msg="登录失败")
            except:
                log.info("登录成功的处理......")
                a = self.dr.find_elements_by_id(
                    "com.qk.butterfly:id/tv_tab")[-1].text
                self.assertEqual(a, "首页", msg="断言已经登录成功")
Exemplo n.º 2
0
 def test_1(self):
     #使用账号密码登录碟声
     #点击密码,进入手机号、密码登录界面
     log.info("点击密码按键,进入账号密码登录界面")
     self.dr.find_elements_by_id('com.qk.butterfly:id/et_login_pwd').click()
     # 使用脚本与测试相结合
     for i in config_1.read_data():
         #进入登录密码页面之后
         self.dr.find_elements_by_id(
             'com.qk.butterfly:id/et_login_phone').send_keys(i[0])
         log.info(f'输入的手机号是:{i[0]}')
         self.dr.find_elements_by_id(
             'com.qk.butterfly:id/et_login_pwd').send_keys(i[1])
         log.info(f'输入的密码是:{i[1]}')
         self.dr.find_elements_by_id('com.qk.butterfly:id/tv_to_login')
         log.info(f'点击登录按钮')
         #断言登录失败
         sleep(5.0)
         """
         if  else  处理登录成功与失败,也可以用  try   except  语句断言
         """
         try:
             #登录失败,还在登录界面
             log.info('登录成功测处理')
             b = self.dr.find_elements_by_id('').text
             print("登录失败")
             self.assertEqual(b, "登录", msg="登录失败")
         except:
             # 断言
             sleep(5.0)
             # 进入登录之后的页面
             a = self.dr.find_elements_by_id('')[-1].text
             self.assertEqual(a, '我的', msg="断言已经登陆成功")
             print("登录成功")
Exemplo n.º 3
0
 def test_1(self):
     #使用账号密码登录碟声
     sleep(5)
     log.info('点击密码按键,进入账号密码登录页面')
     self.dr.find_element_by_id('com.qk.butterfly:id/v_login_pwd').click()
     for i in config_1.read_data():
         self.dr.find_element_by_id(
             'com.qk.butterfly:id/et_login_phone').send_keys(i[0])
         log.info(f'输入的手机是:{i[0]}')
         self.dr.find_element_by_id(
             'com.qk.butterfly:id/et_login_pwd').send_keys(i[1])
         log.info(f'输入的密码是:{i[1]}')
         self.dr.find_element_by_id(
             'com.qk.butterfly:id/tv_to_login').click()
         log.info('点击登录按钮')
         #断言
         try:
             sleep(5)
             log.info('登录失败的处理')
             b = self.dr.find_element_by_id(
                 'com.qk.butterfly:id/tv_to_login').text
             print('登录失败')
             self.assertEqual(b, '登录', msg='登录失败')
         except:
             sleep(2)
             log.info('登录成功的处理')
             a = self.dr.find_elements_by_id(
                 'com.qk.butterfly:id/tv_tab')[-1].text
             print('登录成功')
             self.assertEqual(a, '我的', msg='我已登录成功')
Exemplo n.º 4
0
    def test_1(self):
        # 使用账号密码登录碟声
        # 点击密码,进入手机号,密码登录页面
        log.info("点击密码按键,进入账号密码登录页面")
        self.dr.find_element_by_id("com.qk.butterfly:id/v_login_pwd").click()
        sleep(2)
        #使用脚本与测试数据相结合
        for i in config_1.read_data():
            #进入账号密码登录页面之后
            self.dr.find_element_by_id(
                "com.qk.butterfly:id/et_login_phone").send_keys(i[0])
            sleep(2)
            log.info(f"输入的手机号是:{i[0]}")
            self.dr.find_element_by_id(
                "com.qk.butterfly:id/et_login_pwd").send_keys(i[1])
            sleep(2)
            log.info(f"输入的手机号是:{i[1]}")
            self.dr.find_element_by_id(
                "com.qk.butterfly:id/tv_to_login").click()
            log.info("点击登录按钮")
            #断言
            sleep(6)
            """
            if  else 处理登录成功与失败,也可以使用try except语句做断言

            """
            try:
                log.info("登录失败的处理......")
                b = self.dr.find_element_by_id(
                    "com.qk.butterfly:id/tv_to_login").text
                print("登录失败")
                self.assertEqual(b, "登录", msg="登录失败")
                # if b == "登录":
                #     print("登录失败")
            except:
                #进入登录之后的页面
                log.info("登录成功的处理......")
                a = self.dr.find_elements_by_id(
                    "com.qk.butterfly:id/tv_tab")[-1].text
                self.assertEqual(a, "首页", msg="断言已经登录成功")
Exemplo n.º 5
0
def test_1(self):
    #使用脚本与测试数据相结合
    for i in config_1.read_data():
        #使用账号密码登录
        #self.dr.find_element_by_id("com.qk.butterfly:id/v_login_pwd").click()
        #进入账号密码登录界面
        self.dr.find_element_by_id(
            "com.qk.butterfly:id/et_login_phone").send_keys("i[0]")
        self.dr.find_element_by_id(
            "com.qk.butterfly:id/et_login_pwd").send_keys("i[1]")
        self.dr.find_element_by_id("com.qk.butterfly:id/tv_to_login").click()
        #断言
        sleep(5.0)
        #进入登录之后的页面
        #if else 处理登录成功与失败,也可使用try  except 语句做断言
        try:
            b = self.dr.find_element_by_id("com.qk.butterfly:id/tv_tab").text
            print("登录失败")
            self.assertequal(b, "登录", msg="登录失败")
        except:
            a = self.dr.find_element_by_id(
                "com.qk.butterfly:id/tv_tab")[-1].text
            self.assertequal(a, "我的", msg="断言已登录成功")