def test_03_bangka(self): """ :return:绑卡 """ My_method.My_id(self, module_info['账户'], 'click') My_method.My_id(self, cunguan["充值"], 'click') My_method.my_class_name_id_dianji(self, 'android.widget.EditText', 1, 'click') My_method.my_class_name_id_dianji(self, 'android.view.View', 36, 'click') My_method.my_class_name_id_dianji(self, 'android.view.View', 14, myMethod.bankId(self)) My_method.my_class_name_id_dianji(self, 'android.view.View', 17, 'click') My_method.my_class_name_id_dianji(self, 'android.view.View', 36, 'click') My_method.my_class_name_id_dianji(self, 'android.view.View', 20, '北京') My_method.my_class_name_id_dianji(self, 'android.view.View', 23, '北京') My_method.my_class_name_id_dianji(self, 'android.view.View', 26, myMethod.randomTel(self)) os.popen('adb shell input swipe 50 1000 50 0 100') My_method.my_class_name_id_dianji(self, 'android.view.View', 28, 'click') bangka_chenggong = My_method.my_class_name_id_dianji( self, 'android.view.View', 32, '获取元素') if bangka_chenggong: logging.info('绑卡成功') My_method.app_back(self) else: logging.info('绑卡失败')
def test_03_shouhuo_addres(self): My_method.My_id (self, module_info ['账户'], 'click') My_method.My_id (self, account ['个人中心'], 'click') My_method.My_id(self,account['地址管理'],'click') My_method.My_id(self,account['联系人'],"时寿阳") My_method.My_id(self,account['手机号'],'18519291259') add_info=My_method.My_id(self,account['收货地址格式'],'获取内容') logging.info(add_info) My_method.My_id(self,account['收货地址'],"北京市朝阳区林翠西里国际气候大厦三层") My_method.My_id(self,account['地址保存'],'click') My_method.app_back(self)
def test_02_qianyue(self, names='张三'): """ :param names: :return:签约 """ My_method.My_id(self, module_info['账户'], 'click') My_method.My_id(self, cunguan["充值"], 'click') KT_cunguan = My_method.My_id(self, cunguan['立即开通'], '获取元素') if KT_cunguan: logging.info('存管账户未开通') My_method.My_id(self, cunguan['立即开通'], 'click') My_method.My_id(self, 'name', names) My_method.My_id(self, 'identity', myMethod.randomID(self)) My_method.my_class_name_id_dianji(self, 'android.view.View', 9, 'click') chenggong = My_method.my_class_name_id_dianji( self, 'android.widget.Button', 0, '获取元素') if chenggong: logging.info('开户成功') My_method.my_class_name_id_dianji(self, 'android.widget.Button', 0, 'click') else: logging.info('开户失败') else: logging.info('已经开通存管账户')
def test_02_faxian(self): My_method.My_id(self,module_info['发现'],'click') My_method.My_id(self,faxian['平台数据'],'click',2) My_method.app_back(self) My_method.My_id(self,faxian['安全保障'],'click',2) for a in range (6): for i in range (2): My_method.my_class_name_id_dianji (self, 'android.widget.Image', 1 + a, 'click') My_method.app_back(self) My_method.My_id (self, faxian['积分商城'], 'click') while True: # noinspection PyUnresolvedReferences self.driver.implicitly_wait (3) try: My_method.yiwai_login (self) My_method.My_id (self, module_info ['发现'], 'click') My_method.My_id (self, faxian ['积分商城'], 'click', 2) continue except: jifen = My_method.my_class_name_id_dianji (self, 'android.view.View', 2, '属性', "name") jifen_i = re.findall ('[A-Za-z0-9]+', jifen [0]) jifen_info = jifen_i [0] logging.info (f'积分:{jifen_info}') os.popen ('adb shell input swipe 50 1000 50 750 100')#向上滑动至合适距离 p = 7 zong_jifen = [] for i in range (8): jifen_op = My_method.my_class_name_id_dianji (self, 'android.view.View', p, '属性', "name") jifen_io = re.findall ('[A-Za-z0-9]+', jifen_op [0]) zong_jifen.append (jifen_io [0]) p += 3 logging.info (zong_jifen) suiji_list_len = [7] suiji_list = 7 for w in range (7): suiji_list += 3 suiji_list_len.append (suiji_list) suiji_list_to = random.randrange (7, 28, 3) weizhi_info = suiji_list_len.index (suiji_list_to) My_method.my_class_name_id_dianji (self, 'android.view.View', suiji_list_to, 'click',3) weizhi_jifen = zong_jifen[weizhi_info] if weizhi_jifen<=jifen_info: My_method.my_class_name_id_dianji(self,'android.view.View',22,'click',2) My_method.my_class_name_id_dianji(self,'android.widget.Button',1,'click') jietu.jietu_picture (self, "兑换积分") My_method.my_class_name_id_dianji(self,'android.widget.Button',0,'click') logging.info ('兑换成功') My_method.app_back(self,2) else: logging.info('兑换失败') My_method.app_back(self,2) break My_method.My_id(self,faxian['活动中心'],'click',2) My_method.app_back(self) My_method.my_class_name_id_dianji(self,faxian['更多'],6,'click') My_method.app_back(self)
def test_01_shouye(self): My_method.My_id(self,module_info['首页'],'click') My_method.My_id(self,shouye_modul['榜上有名'],'click',3) My_method.app_back(self) My_method.My_id(self,shouye_modul['新手指引'],'click',2) My_method.app_back(self) My_method.My_id(self,shouye_modul['邀请好友'],'click',2) My_method.app_back(self) My_method.My_id(self,shouye_modul['每日签到'],'click',2) while True: try: while True: try: huoqu_jifen=My_method.my_class_name_id_dianji(self,'android.view.View',1,'属性',"name") time.sleep (3) logging.info (huoqu_jifen [0]) break except: continue b = My_method.my_class_name_id_dianji (self, 'android.view.View', 53, 'click') if b: self.driver.implicitly_wait (3) try: qiandao_jifen = My_method.my_class_name_id_dianji (self, 'android.widget.Button', 0, '属性', "name", 4) My_method.my_class_name_id_dianji (self, 'android.widget.Button', 0, 'click') logging.info (qiandao_jifen[0]) break except: logging.info ("已经签到了") break except: My_method.yiwai_login(self) continue My_method.app_back(self)
def test_yaoqing_haoyou(self): My_method.My_id(self, module_info['首页'], 'click') My_method.My_id(self, shouye_modul['邀请好友'], 'click') #先查看规则 self.driver.implicitly_wait(20) try: My_method.my_class_name_id_dianji(self, 'android.view.View', 2, 'click') My_method.my_class_name_id_dianji(self, 'android.view.View', 10, 'click') except: logging.info("查看规则失败了") yaoqing_zhanji = ['邀请人数', '累计红包奖励', '累计佣金奖励'] for i in range(3): renshu = My_method.my_class_name_id_dianji(self, 'android.view.View', 6 + i, '属性', "name") time.sleep(2) logging.info(f'{yaoqing_zhanji[i]}:{renshu[0]}') My_method.My_id(self, shouye_modul['邀请-好友'], 'click') #就默认选择QQ分享了 My_method.my_class_name_id_dianji(self, 'android.widget.ImageButton', 2, 'click') try: self.driver.implicitly_wait(1) My_method.my_class_name_id_dianji(self, 'android.widget.TextView', 4, 'click') My_method.My_id(self, shouye_modul['分享发送'], 'click') My_method.My_id(self, 'com.tencent.mobileqq:id/dialogLeftBtn', 'click') jietu.jietu_picture(self, "邀请好友成功") My_method.app_back(self) except: logging.info("QQ没有登录,分享失败") My_method.app_back(self, 2)
def test_01_fengxian(self): My_method.My_id (self, module_info ['首页'], 'click') logging.info("首先获取新手标的详细信息") xinshou_info=['标得名称:','性质:','活动','预期年化收益:','活动加息:','投资期限:','可投金额:'] xinshou_jieguo=[] for i in range(6): biao_name=My_method.my_class_name_id_dianji(self,'android.widget.TextView',7+i,'text') xinshou_jieguo.append(biao_name[0]) info=dict(map(lambda x,y:[x,y], xinshou_info,xinshou_jieguo)) logging.info(f'标得详细信息如下:{info}') My_method.My_id(self,'com.yourenkeji.shenghuidai:id/buy_now_tv','click') #点击 立即投资 My_method.My_id(self,'com.yourenkeji.shenghuidai:id/bid_detals_et_bidMoney',100) #就是看看可不可以投资 My_method.My_id(self,'com.yourenkeji.shenghuidai:id/bid_detals_bt_bid','click') My_method.My_id(self,'com.yourenkeji.shenghuidai:id/bid_buy_bt','click') #立即购买 jietu.jietu_picture(self,nowtime+"新手标") logging.info("你已经不是新手了,不能在投资新手标了")
def test_01_fengxian(self): My_method.My_id(self, module_info['账户'], 'click') My_method.My_id(self, account['个人中心'], 'click') My_method.My_id(self, account['风险评估'], 'click') self.driver.find_element_by_xpath( '//android.view.View[@content-desc="重新测评"]').click() cishu = 1 while cishu <= 10: #强制获取题目内容,不考虑失败结果 while True: number = 1 try: timu = My_method.my_class_name_id_dianji( self, 'android.view.View', 3, '属性', "name") #答题的题目 time.sleep(3) logging.info(f'题目:{timu[0]}') break except: number += 1 if number < 5: continue else: break xuan_xiang = random.randint(3, 6) xuanxiang_info = My_method.my_class_name_id_dianji( self, 'android.view.View', xuan_xiang, '属性', "name") #获得选项信息 logging.info(f'选项:{xuanxiang_info[0]}') My_method.my_class_name_id_dianji(self, 'android.view.View', xuan_xiang, 'click') if cishu <= 9: self.driver.find_element_by_xpath( '//android.view.View[@content-desc="下一题"]').click() cishu += 1 elif cishu == 10: self.driver.find_element_by_xpath( '//android.view.View[@content-desc="完成"]').click() break pinggu_jieguo = My_method.my_class_name_id_dianji( self, 'android.view.View', 2, '属性', "name") #获得评估完成的信息 pinggu_jieguo_two = My_method.my_class_name_id_dianji( self, 'android.view.View', 3, '属性', "name") time.sleep(2) logging.info(f'评估结果:{pinggu_jieguo[0]}\n详情为:{pinggu_jieguo_two[0]}') self.driver.find_element_by_xpath( '//android.widget.Button[@content-desc="去投资"]').click()