コード例 #1
0
 def edit_nickname_right(
         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()
         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()
         if (second > 1):
             util.getImage(MyInfoHelper.driver, case_name, second)
         else:
             util.getImage(MyInfoHelper.driver, case_name, 1)
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_back_button).click()
         time.sleep(1)
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
コード例 #2
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
コード例 #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 login(self, mobile, pwd, case_name, second, driver_stat):
        try:

            if driver_stat == 1:
                print("driver_stat=1,初始化driver")
                LoginHelper.driver = BaseHelper.get_redmi_driver(
                    self)  # 创建driver
            else:

                pass
            loginPage = LoginPage()
            util = Utils()
            if mobile == "":
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).click()
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).clear()
            else:
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).click()
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).clear()
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).send_keys(mobile)
            if pwd == "":
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).click()
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).clear()
            else:
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).click()
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).clear()
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).send_keys(pwd)
            util.getElementById(LoginHelper.driver, loginPage.seepwd).click()
            # util.clearText(loginPage.password, driver);
            # util.clearText(driver, loginPage.password);
            LoginHelper.driver.hide_keyboard()
            util.getElementById(LoginHelper.driver,
                                loginPage.loginButton).click()
            if second > 0:
                #util.take_screenShot(LoginHelper.driver, case_name, second)
                util.getImage(LoginHelper.driver, case_name, second)
            else:
                #util.take_screenShot(LoginHelper.driver, case_name, 0)
                util.getImage(LoginHelper.driver, case_name, 0)
            print("本次测试完成")

        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
コード例 #5
0
 def recharge_wechat_input(self,amount,case_name,second):    #输入金额进行充值
     try:
         time.sleep(second)
         Utils.getElementById(self,MyHelper.driver,MyPage.resid_my_button).click()
         
         if second>0 :
             Utils.getImage(self,MyHelper.driver, case_name, second)
         else:
             Utils.getImage(self,MyHelper.driver, case_name, 1)
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
コード例 #6
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
コード例 #7
0
 def to_my_page(self,case_name,second):
     try:
         time.sleep(second)
         my_page = MyPage()
         util=Utils()
         util.getElementById(MyHelper.driver,my_page.resid_my_button).click()
         if second>0 :
             util.getImage(MyHelper.driver, case_name, second)
         else:
             util.getImage(MyHelper.driver, case_name, second)
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
コード例 #8
0
 def to_hot_page(self, case_name, second=0):
     try:
         hot_anchor_page = HotAnchorPage()
         util = Utils()
         util.getElementById(HotAnchorHelper.driver,
                             hot_anchor_page.resid_home_button).click()
         if second > 0:
             #util.take_screenShot(LoginHelper.driver, case_name, second)
             util.getImage(HotAnchorHelper.driver, case_name, second)
         else:
             #util.take_screenShot(LoginHelper.driver, case_name, 0)
             util.getImage(HotAnchorHelper.driver, case_name, 0)
         print("本次测试完成")
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
コード例 #9
0
 def to_anchor_room(self, case_name, anchor_index, second=0):
     try:
         hot_anchor_page = HotAnchorPage()
         util = Utils()
         util.get_element_by_index(HotAnchorHelper.driver,
                                   hot_anchor_page.resid_anchor,
                                   anchor_index).click()
         if second > 0:
             #util.take_screenShot(LoginHelper.driver, case_name, second)
             util.getImage(HotAnchorHelper.driver, case_name, second)
         else:
             #util.take_screenShot(LoginHelper.driver, case_name, 0)
             util.getImage(HotAnchorHelper.driver, case_name, 0)
         print("本次测试完成")
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
コード例 #10
0
 def to_my_info(self, case_name,
                second):  #去我的个人信息页面   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()
         if (second > 1):
             util.getImage(MyInfoHelper.driver, case_name, second)
         else:
             util.getImage(MyInfoHelper.driver, case_name, 1)
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_back_button).click()
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
コード例 #11
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)
コード例 #12
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