コード例 #1
0
 def get_code_by_mobile(
         self,
         mobile="",
         case_name="",
         second=0):  #实名认证   param:mobile-手机号,case_name-用例名称,second-截图等待秒数
     try:
         my_info_page = MyInfoPage()
         util = Utils()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_my_button).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_myinfo_button).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_myinfo_updatepwd).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_updatepwd_mobile).click()
         util.getElementById(
             MyInfoHelper.driver,
             my_info_page.resid_updatepwd_mobile).send_keys(mobile)
         util.getElementById(
             MyInfoHelper.driver,
             my_info_page.resid_updatepwd_get_code_button).click()
         if (second > 1):
             util.getImage(MyInfoHelper.driver, case_name, second)
         else:
             util.getImage(MyInfoHelper.driver, case_name, 1)
         util.tap(MyInfoHelper.driver, 28, 72, 56,
                  110)  #此处返回使用绝对坐标来点击,使用id会有获取不到元素异常
         time.sleep(1)
         util.tap(MyInfoHelper.driver, 28, 72, 56, 110)
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
コード例 #2
0
 def clear_cache_cancel(self, case_name, second):  #清理缓存点取消
     try:
         time.sleep(second)
         my_page = MyPage()
         util = Utils()
         util.getElementById(MyHelper.driver, my_page.resid_my_button)
         #点击清理缓存,会弹出确认框
         util.getElementById(MyHelper.driver,
                             my_page.resid_clear_cache).click()
         #由于uiauto定位不到确认框元素,此处采用绝对定位
         #取消  128  680,245-744
         #确定  449  695,600 746
         #点击取消
         time.sleep(2)
         util.tap(MyHelper.driver, 128, 680, 245, 744)
         if second > 0:
             util.take_screenShot(MyHelper.driver, case_name, second)
         else:
             util.take_screenShot(MyHelper.driver, case_name, 0)
     except Exception as e:
         print("发现异常")
         print(e)
         Utils.getElementById(self, MyHelper.driver,
                              MyPage.resid_back_button)
         raise SystemError
コード例 #3
0
    def identity_relname(
        self,
        relname="",
        relcard="",
        case_name="",
        second=0
    ):  #实名认证   param:relname-真实姓名,relcard-身份证号,case_name-用例名称,second-截图等待秒数
        try:

            my_info_page = MyInfoPage()
            util = Utils()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_my_button).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_myinfo_button).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_myinfo_identity).click()
            if (relname == "" and relcard == ""):
                pass
            else:
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_identity_relname).click()
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_identity_relname).clear()
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_identity_relname).send_keys(relname)
                if (relcard == ""):
                    pass
                else:
                    util.getElementById(
                        MyInfoHelper.driver,
                        my_info_page.resid_identity_relcard).click()
                    util.getElementById(
                        MyInfoHelper.driver,
                        my_info_page.resid_identity_relcard).clear()
                    util.getElementById(
                        MyInfoHelper.driver,
                        my_info_page.resid_identity_relcard).send_keys(relcard)
            util.getElementById(
                MyInfoHelper.driver,
                my_info_page.resid_identity_commit_button).click()
            if (second > 1):
                util.getImage(MyInfoHelper.driver, case_name, second)
            else:
                util.getImage(MyInfoHelper.driver, case_name, 0)
            util.tap(MyInfoHelper.driver, 28, 72, 56,
                     110)  #此处返回使用绝对坐标来点击,使用id会有获取不到元素异常
            time.sleep(1)
            util.tap(MyInfoHelper.driver, 28, 72, 56, 110)
        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
コード例 #4
0
    def edit_nickname_error(
            self,
            nick_name="",
            case_name="",
            second=0):  #修改昵称   param:case_name-用例名称,second-截图等待秒数
        try:
            my_info_page = MyInfoPage()
            util = Utils()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_my_button).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_myinfo_button).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_myinfo_nickname).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_nickname_input).click()
            if (nick_name == ""):
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_savename_button).click()
            else:
                util.getElementById(MyInfoHelper.driver,
                                    my_info_page.resid_nickname_input).clear()
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_nickname_input).send_keys(nick_name)
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_savename_button).click()
                time.sleep(1)
                util.getElementById(MyInfoHelper.driver,
                                    my_info_page.resid_mes_button).click()
                time.sleep(1)
            if (second > 1):
                util.getImage(MyInfoHelper.driver, case_name, second)
            else:
                util.getImage(MyInfoHelper.driver, case_name, 0)

            util.tap(MyInfoHelper.driver, 28, 72, 56,
                     110)  #此处返回使用绝对坐标来点击,使用id会有获取不到元素异常
            time.sleep(1)
            util.tap(MyInfoHelper.driver, 28, 72, 56, 110)
            #util.getElementById(MyInfoHelper.driver,my_info_page.resid_back_button).click()
            #MyInfoHelper.driver.find_element_by_xpath("//*[@resource-id='com.dbljoy.lottery:id/img_goback']").click()
            time.sleep(1)
            #util.getElementById(MyInfoHelper.driver,my_info_page.resid_back_button).click()
            #MyInfoHelper.driver.find_element_by_xpath("//*[@resource-id='com.dbljoy.lottery:id/img_goback']").click()
        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
コード例 #5
0
 def recharge_wechat_click_first(self,amount,case_name,second):   #点击金额进行充值
     try:
         time.sleep(second)
         Utils.getElementById(self,MyHelper.driver,MyPage.resid_my_button).click()
         Utils.getElementById(self,MyHelper.driver,MyPage.resid_recharge).click()
         if(amount==10):
             Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_ten).click()
             
         elif(amount==20):
             Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_twenty).click()
             
         elif(amount==50):
             Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_fifty).click()
         elif(amount==100):
             Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_oneHundred).click()
         elif(amount==150):
             Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_oneHundredAndFifty).click()
         elif(amount==200):
             Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_twoHundred).click()
         elif(amount==300):
             Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_threeHundred).click()
         elif(amount==500):
             Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_fiveHundred).click()
         else:
             print("请输入要点击选择的正确金额")
             raise SystemError
         Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_wechatpay).click()
         Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_commit).click()
         Utils.tap(self,MyHelper.driver,FinancialOperationPage.resposition_recharge_instruction_agree_x1,
                   FinancialOperationPage.resposition_recharge_instruction_agree_y1,
                   FinancialOperationPage.resposition_recharge_instruction_agree_x2,
                   FinancialOperationPage.resposition_recharge_instruction_agree_y2)
         if second>0 :
             Utils.getImage(self,MyHelper.driver, case_name, second)
         else:
             Utils.getImage(self,MyHelper.driver, case_name, 1)
         Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_recharge_wechat_back).click()
         Utils.getElementById(self,MyHelper.driver,FinancialOperationPage.resid_back_button).click()
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
コード例 #6
0
 def exit(
     self,
     stat=0,
     case_name="",
     second=0
 ):  #退出登录  param:stat-是否确认退出,1是确定0是取消,case_name--用例名称,second-截图等待秒数
     try:
         Utils.getElementById(self, MyInfoHelper.driver,
                              MyInfoPage.resid_my_button).click()
         Utils.getElementById(self, MyInfoHelper.driver,
                              MyInfoPage.resid_myinfo_button).click()
         Utils.getElementById(self, MyInfoHelper.driver,
                              MyInfoPage.resid_myinfo_exit_button).click()
         if (stat > 0):
             Utils.tap(self, MyInfoHelper.driver,
                       MyInfoPage.resposition_confirm_x1,
                       MyInfoPage.resposition_confirm_y1,
                       MyInfoPage.resposition_confirm_x2,
                       MyInfoPage.resposition_confirm_y2)
             time.sleep(1)
             Utils.getImage(self, MyInfoHelper.driver, case_name, 1)
             Utils.getElementById(self, MyInfoHelper.driver,
                                  LoginPage.password).click()
             Utils.getElementById(self, MyInfoHelper.driver,
                                  LoginPage.password).send_keys("111111")
             Utils.getElementById(self, MyInfoHelper.driver,
                                  LoginPage.loginButton).click()
             time.sleep(4)
         else:
             Utils.tap(self, MyInfoHelper.driver,
                       MyInfoPage.resposition_cancel_x1,
                       MyInfoPage.resposition_cancel_y1,
                       MyInfoPage.resposition_cancel_x2,
                       MyInfoPage.resposition_cancel_y2)
             Utils.getImage(self, MyInfoHelper.driver, case_name, 1)
             Utils.tap(self, MyInfoHelper.driver, 28, 72, 56,
                       110)  #此处返回使用绝对坐标来点击,使用id会有获取不到元素异常
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
     time.sleep(1)