def after_signup(self): dr = self.driver try: WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/user_info")).click() time.sleep(1) #修改名字 if random.randint(0, 1): WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/nickname_layout")).click() time.sleep(1) #输入昵称 edts = WebDriverWait( dr, 15).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) edts.send_keys(self.get_filemessage("name.txt")) time.sleep(1) WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/comfirmed_change")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/btn_callback")).click() time.sleep(1) for x in range(10): dr.press_keycode(4) time.sleep(1) try: WebDriverWait(dr, 2).until( lambda d: d.find_element_by_name("取消")).click() time.sleep(1) try: dr.tap(random.randint(800, 1000), random.randint(100, 1600)) except: dr.tap(random.randint(550, 700), random.randint(100, 1000)) time.sleep(5) break except TimeoutException: pass except: for x in range(10): dr.press_keycode(4) time.sleep(1) try: WebDriverWait(dr, 2).until( lambda d: d.find_element_by_name("取消")).click() time.sleep(1) try: dr.tap(random.randint(800, 1000), random.randint(100, 1600)) except: dr.tap(random.randint(550, 700), random.randint(100, 1000)) time.sleep(5) break except TimeoutException: pass return self.do
def uuwise(self): dr = self.driver dr.press_keycode(3) time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("UUWiseDemo")).click() time.sleep(1) try: dr.find_element_by_name("查分") dr.press_keycode(4) time.sleep(1) except NoSuchElementException: pass btlogin = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.example.uuwisedemo:id/btn_login")) edtsuser = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.example.uuwisedemo:id/et_loginname")) edtspwd = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.example.uuwisedemo:id/et_loginpwd")) uuuser = '******' uupwd = 'meiriq2014' if edtsuser.text == uuuser and edtspwd.text == uupwd: pass else: edtsuser.send_keys(uuuser) time.sleep(1) edtspwd.send_keys(uupwd) time.sleep(1) btlogin.click() screenshotpath = dr.find_element_by_id("com.example.uuwisedemo:id/et_path") for x in range(10): screenshotpath.click() time.sleep(0.5) dr.press_keycode(123) time.sleep(0.5) for i in range(40): dr.press_keycode(67) if screenshotpath.text == "路径": break screenshotpath.send_keys('/sdcard/captcha.png') time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.example.uuwisedemo:id/btn_recognize")).click() time.sleep(1) captcha = None try: msg = WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id("com.example.uuwisedemo:id/txt_code")) match = re.search(r'验证码:\d+\|([0-9a-zA-Z]+)', msg.text) if match: captcha = match.group(1) else: captcha = None except: pass dr.press_keycode(4) time.sleep(1) dr.press_keycode(82) time.sleep(2) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name(self.appname)).click() return captcha
def close_connection(self): dr = self.driver if self.city == "广州": server_ip = ["183.47.6.115", "gzjsq51.2288.org", "gzjsq86.2288.org", "zhjsq77.2288.org", "zhjsq78.2288.org", "hyjsq81.2288.org", "szjsq85.2288.org", "hzjsq80.2288.org", "dgjsq50.2288.org", "mzjsq98.2288.org"] try: WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("已连接")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("断开连接")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.android.settings:id/detail_arrow")).click() time.sleep(1) edts = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.android.settings:id/server")) edts.click() dr.press_keycode(123) time.sleep(1) time.sleep(0.5) for i in range(30): dr.press_keycode(67) edts.send_keys(choice(server_ip)) time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("确定")).click() time.sleep(1) print("thats ok") except TimeoutException as e: print("in else") WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.android.settings:id/detail_arrow")).click() time.sleep(1) edts = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.android.settings:id/server")) edts.click() dr.press_keycode(123) time.sleep(1) time.sleep(0.5) for i in range(30): dr.press_keycode(67) edts.send_keys(choice(server_ip)) time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("确定")).click() time.sleep(1) else: try: WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("已连接")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("断开连接")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("PPTP VPN")).click() time.sleep(1) print("thats ok") except TimeoutException as e: print("in else") dr.find_element_by_class_name("android.widget.RadioButton").click() time.sleep(1) return self.reconnect
def modify_data(self): dr = self.driver #使用GPS模拟 gps = dr.find_element_by_id("com.rong.xposed.fakelocation:id/gps_switch") if gps.text == "关闭": gps.click() time.sleep(0.5) #输入经度 lat = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.rong.xposed.fakelocation:id/edit_lat")) for x in range(10): lat.click() time.sleep(0.5) dr.press_keycode(123) time.sleep(0.5) for i in range(40): dr.press_keycode(67) if lat.text == "": break lat.send_keys(self.latnum) time.sleep(0.5) #输入纬度 lot = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.rong.xposed.fakelocation:id/edit_lot")) for x in range(10): lot.click() time.sleep(0.5) dr.press_keycode(123) time.sleep(0.5) for i in range(40): dr.press_keycode(67) if lot.text == "": break lot.send_keys(self.lotnum) time.sleep(1) #即时更新 dr.find_element_by_id("com.rong.xposed.fakelocation:id/chk_instant_update").click() time.sleep(1) print("修改定位完成") #退出 dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.exit
def after_signup(self): dr = self.driver #选择性别 WebDriverWait(dr, 20).until(lambda d: d.find_element_by_id(choice(["", ""]))).click() time.sleep(1) #输入昵称 edts = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_class_name("android.widget.EditText")) edts.send_keys(self.get_filemessage("name.txt")) time.sleep(1) #选择头像 WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("")).click() time.sleep(1) WebDriverWait(dr, 5).until(lambda d: d.find_element_by_name("从相册选择")).click() time.sleep(1) WebDriverWait(dr, 5).until(lambda d: d.find_element_by_name("文件管理")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("1")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("1touxiang")).click() time.sleep(1) for i in range(random.randint(0, 80)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(1) time.sleep(5) self.select_one_by_id("com.android.fileexplorer:id/file_image") time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_name("应用")).click() time.sleep(5) #保存信息按钮 WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("")).click() time.sleep(10) #检测信息保存完毕跳转页面 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id("")) #记录帐号密码 try: with open('/sdcard/1/user%s.log' % self.appname_en, 'a') as f: f.write('\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) except: with open('D:/brush/slave/scripts/doc/user%s.log' % self.appname_en, 'a') as f: f.write('\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) time.sleep(1) return self.do
def add_remain_data(self): dr = self.driver dr.find_element_by_id( "com.soft.apk008v:id/menu_remainControl").click() ## 留存控制按键 time.sleep(1) #清除当前留存记录 for x in range(60): try: WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id( "com.soft.apk008v:id/remain_item_title")) dr.swipe(400, 200, 410, 200, 50) WebDriverWait( dr, 5).until(lambda d: d.find_element_by_name("确定")).click() time.sleep(0.5) except TimeoutException: break #添加留存记录 add_end = False find_day = self.NO_NEW_DAY for x in range(60): if add_end: break WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.soft.apk008v:id/menu_remain_addRecord")).click() #添加记录按钮 time.sleep(0.5) # 获取昨天的时间datetime begin_time = datetime.datetime.now() #设置留存开始时间 if self.begin_time_month: begin_time = begin_time.replace(month=self.begin_time_month) if self.begin_time_day: begin_time = begin_time.replace(day=self.begin_time_day) yes_time = begin_time + datetime.timedelta(days=-x - 1) #滑动查找 for i in range(10): try: WebDriverWait(dr, 2).until(lambda d: d.find_element_by_name( yes_time.strftime('%Y-%m-%d'))).click() time.sleep(0.5) edt = WebDriverWait( dr, 10).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) if self.begin_time_month or self.begin_time_day: edt.send_keys( self.remain_rate[x + (datetime.datetime.now() - begin_time).days]) else: edt.send_keys(self.remain_rate[x]) time.sleep(0.5) WebDriverWait(dr, 10).until( lambda d: d.find_element_by_name("确定")).click() time.sleep(0.5) find_day = self.NO_NEW_DAY break except TimeoutException: dr.swipe(300, 800, 300, 500) time.sleep(1) if i == 9: dr.press_keycode(4) time.sleep(1) if find_day == 0: add_end = True else: find_day -= 1 dr.press_keycode(4) time.sleep(1)
def signup(self): dr = self.driver WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.qq.ac.android:id/container_header")).click() time.sleep(1) #QQ登录 try: WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.qq.ac.android:id/qq_login")).click() time.sleep(1) except TimeoutException: pass #进入QQ登录界面 WebDriverWait(dr, 60).until( lambda d: d.find_element_by_id("com.tencent.mobileqq:id/name")) time.sleep(1) try: with open('/sdcard/1/qq.txt', 'r', encoding='utf-8') as f: tfile = "/sdcard/1/qq.txt" strqq = f.read() except: with open('D:/brush/slave/scripts/doc/qq.txt', 'r', encoding='utf-8') as f: tfile = "D:/brush/slave/scripts/doc/qq.txt" strqq = f.read() match = re.search(r'notuse,(\d+,[0-9a-zA-Z\_\@]+)', strqq) if match: self.phone = re.search(r'notuse,(\d+)', match.group(0)).group(1) self.pwd = re.search(r'notuse,\d+,([0-9a-zA-Z\_\@]+)', match.group(0)).group(1) #修改标志QQ已使用 try: lines = open(tfile, 'r').readlines() flen = len(lines) for i in range(flen): if match.group(0) in lines[i]: usetime = '(time %s.%s %s:%s:%s)' % ( time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec) modify = 'use,' + match.group(1) + " " + usetime lines[i] = lines[i].replace(match.group(0), modify) break open(tfile, 'w').writelines(lines) except Exception as e: print(e) else: #帐号已用完 dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.do edit = WebDriverWait(dr, 15).until( lambda d: d.find_elements_by_class_name("android.widget.EditText")) edit[0].send_keys(self.phone) time.sleep(1) edit[1].send_keys(self.pwd) time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("登 录")).click() time.sleep(5) try: for _ in range(5): WebDriverWait( dr, 60).until(lambda d: d.find_element_by_name("看不清?换一张")) time.sleep(5) screenshot("/sdcard/screenshot.png") run_qpy2_script("get_captchaimg_qqdongman.py") imgcaptcha = self.uuwise() if imgcaptcha is None: print("getimgcaptcha failed") self.try_count += 1 if self.try_count > 5: self.try_count = 0 return self.exit dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.signup dr.press_keycode(4) time.sleep(5) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("登 录")).click() time.sleep(1) WebDriverWait( dr, 30).until(lambda d: d.find_element_by_name("看不清?换一张")) time.sleep(1) edts = WebDriverWait( dr, 15).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) edts.send_keys(imgcaptcha) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.tencent.mobileqq:id/ivTitleBtnRightText")).click() time.sleep(5) try: #图片验证码是否正确 WebDriverWait( dr, 10).until(lambda d: d.find_element_by_name("看不清?换一张")) time.sleep(1) except TimeoutException: break #注册成功页面检测 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.qq.ac.android:id/tab_icon_recommend")) time.sleep(1) #记录帐号密码 try: with open('/sdcard/1/user%s.log' % self.appname_en, 'a') as f: f.write('\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) except: with open( 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en, 'a') as f: f.write('\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) time.sleep(1) except TimeoutException: try: WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id( "com.qq.ac.android:id/tab_icon_center")) time.sleep(1) return self.do except TimeoutException: pass #修改标志QQ使用失败 try: lines = open(tfile, 'r').readlines() flen = len(lines) for i in range(flen): if modify in lines[i]: lines[i] = lines[i].replace(modify, modify + ',false') break open(tfile, 'w').writelines(lines) except Exception as e: print(e) screenshot( "/sdcard/error/%s.png" % (str(time.localtime().tm_mon) + str(time.localtime().tm_mday) + str(time.localtime().tm_hour) + str(time.localtime().tm_min) + str(time.localtime().tm_sec))) time.sleep(5) self.try_count += 1 if self.try_count > 5: self.try_count = 0 return self.exit dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.signup return self.do
def menu2(self): dr = self.driver try: for _ in range(random.randint(1, 2)): #随机滑动 for x in range(random.randint(1, 3)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(400, 600)) time.sleep(random.randint(2, 5)) #随机选择新闻查看 selectone = WebDriverWait( dr, 10).until(lambda d: d.find_elements_by_id( choice([ "com.shwatch.news:id/news_1smallitem_layout", "com.shwatch.news:id/section_newsitem" ]))) selectone[random.randint(0, selectone.__len__() - 1)].click() time.sleep(random.randint(5, 10)) #随机滑动 for x in range(random.randint(2, 4)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(400, 600)) time.sleep(random.randint(2, 10)) #收藏 if random.randint(0, 4) == 0: try: WebDriverWait( dr, 10).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/collection_btn")).click() time.sleep(1) except TimeoutException: pass #喜欢 if random.randint(0, 4) == 0: try: WebDriverWait( dr, 10).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/news_praise")).click() time.sleep(1) except TimeoutException: pass #评论 if random.randint(0, 9) == 0 and self.issign: try: contentnum = WebDriverWait( dr, 10).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/comment_account")) if int(contentnum.text) > 3: contentnum.click() time.sleep(5) self.swipes(300, random.randint(800, 1000), 300, random.randint(400, 600), random.randint(0, 3), 2, 5) contenttext = WebDriverWait( dr, 30).until(lambda d: d.find_elements_by_id( "com.shwatch.news:id/enter_ticket")) time.sleep(1) comtext = contenttext[random.randint( 0, contenttext.__len__() - 1)].text WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/write_comment") ).click() time.sleep(1) edit = WebDriverWait(dr, 30).until( lambda d: d.find_element_by_class_name( "android.widget.EditText")) edit.send_keys(comtext) time.sleep(1) WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/send_message_btn") ).click() time.sleep(1) WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/btn_callback")).click( ) time.sleep(1) except TimeoutException: pass dr.press_keycode(4) time.sleep(1) self.readnum -= 1 self.ismenu2 = False except Exception as e: print("error in menu2") return self.exception_returnapp() return self.do
def after_signup(self): dr = self.driver WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/tv_user_nickname")).click() time.sleep(1) #输入昵称 name = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/et_nickname")) name.click() time.sleep(0.5) dr.press_keycode(123) time.sleep(0.5) for i in range(10): dr.press_keycode(67) name.send_keys(self.get_filemessage("name.txt")) time.sleep(1) #选择性别 if random.randint(0, 1): WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/tv_gender")).click() time.sleep(1) dr.swipe(300, 1180, 300, 1100) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("确定")).click() time.sleep(1) #选择年龄 if not random.randint(0, 4): WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/tv_age")).click() time.sleep(1) self.swipes(300, 1180, 300, 1100, random.randint(17, 30), 1, 1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("确定")).click() time.sleep(1) #保存信息按钮 WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/ibtn_right")).click() time.sleep(10) #检测信息保存完毕跳转页面 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/rbtn_personal_center")) #选择头像 if not random.randint(0, 9): WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/chiv_user_header")).click() time.sleep(1) WebDriverWait( dr, 5).until(lambda d: d.find_element_by_name("相册")).click() time.sleep(1) WebDriverWait( dr, 5).until(lambda d: d.find_element_by_name("文件管理")).click() time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("1")).click() time.sleep(1) WebDriverWait(dr, 15).until( lambda d: d.find_element_by_name("1touxiang")).click() time.sleep(1) for i in range(random.randint(0, 80)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(1) time.sleep(5) self.select_one_by_id("com.android.fileexplorer:id/file_image") time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/btn_done")).click() time.sleep(1) #检测信息保存完毕跳转页面 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/rbtn_personal_center")) self.issign = True #记录帐号密码 try: with open('/sdcard/1/user%s.log' % self.appname_en, 'a') as f: f.write( '\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) except: with open( 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en, 'a') as f: f.write( '\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) time.sleep(1) return self.do
def signup(self): dr = self.driver pwd_li = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ] self.pwd = "" for _ in range(random.randint(8, 10)): self.pwd += choice(pwd_li) try: #进入注册页面 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.zijinbank:id/login_btn_register_account") ).click() time.sleep(1) #选择接码平台获取手机号码 self.phone = self.code.getPhone() edts = WebDriverWait( dr, 60).until(lambda d: d.find_elements_by_class_name( "android.widget.EditText")) #输入手机号码 edts[0].send_keys(self.phone) time.sleep(1) #输入密码 edts[1].send_keys(self.pwd) time.sleep(1) edts[2].send_keys(self.pwd) time.sleep(1) WebDriverWait(dr, 10).until(lambda d: d.find_element_by_class_name( "android.widget.CheckBox")).click() time.sleep(1) dr.swipe(300, 1000, 300, 900) time.sleep(1) #点击获取验证码按钮 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.zijinbank:id/register_btn_register") ).click() time.sleep(5) try: WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.pafinancialtech.zijinbank:id/tv_sms")).click() time.sleep(5) except TimeoutException: print("getMessage failed,try_count:%s" % self.try_count) #释放号码 self.code.releasePhone(self.phone) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(1) return self.signup #选择接码平台获取验证码 #验证码:799971。尊敬的客户您好:您于2016年12月21日14时36分使用紫金农商银行平台用户注册服务(5分钟内有效),切勿泄漏并妥善保管。【江苏农信】 regrex = r'验证码:(\d+)' captcha = self.code.waitForMessage(regrex, self.phone) if captcha is None: print("getMessage failed,try_count:%s" % self.try_count) #释放号码 self.code.releasePhone(self.phone) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.signup edts = WebDriverWait( dr, 15).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) #输入验证码 edts.send_keys(captcha) time.sleep(1) #点击完成按钮按钮 WebDriverWait( dr, 10).until(lambda d: d.find_element_by_name("确定")).click() time.sleep(5) #检测注册成功进入下一步 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.pafinancialtech.zijinbank:id/iv_title_right_image") ).click() time.sleep(1) try: WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.pafinancialtech.zijinbank:id/btn_center")).click() time.sleep(1) except TimeoutException: pass #记录帐号密码 try: with open('/sdcard/1/user%s.log' % self.appname_en, 'a') as f: f.write('\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) except: with open( 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en, 'a') as f: f.write('\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) time.sleep(1) return self.do except Exception as e: print("error in getPhone,try_count:%s" % self.try_count) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(2) dr.press_keycode(4) time.sleep(2) return self.signup
def after_signup(self): dr = self.driver try: WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/slideMenu_homepage")).click() time.sleep(1) WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/homepage_user_headimg")).click() time.sleep(1) #修改名字 if random.randint(0, 1): WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/mainpage_user_nickname")).click() time.sleep(1) #输入昵称 edts = WebDriverWait( dr, 15).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) edts.send_keys(self.get_filemessage("name.txt")) time.sleep(1) WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/comfirmed_change")).click() time.sleep(1) #修改头像 if random.randint(0, 4) == 0: WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/mainpage_user_headimg")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/mainpage_btn_picgroup")).click() time.sleep(1) WebDriverWait( dr, 5).until(lambda d: d.find_element_by_name("文件管理")).click() time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("1")).click() time.sleep(1) WebDriverWait(dr, 15).until( lambda d: d.find_element_by_name("1touxiang")).click() time.sleep(1) self.swipes(300, random.randint(800, 1000), 300, random.randint(300, 500), random.randint(0, 80)) time.sleep(5) self.select_one_by_id("com.android.fileexplorer:id/file_image") time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("应用")).click() time.sleep(5) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/mainpage_btn_back")).click() time.sleep(1) for x in range(10): dr.press_keycode(4) time.sleep(1) try: WebDriverWait(dr, 2).until( lambda d: d.find_element_by_name("取消")).click() time.sleep(1) try: dr.tap(random.randint(800, 1000), random.randint(100, 1600)) except: dr.tap(random.randint(550, 700), random.randint(100, 1000)) time.sleep(5) break except TimeoutException: pass except: for x in range(10): dr.press_keycode(4) time.sleep(1) try: WebDriverWait(dr, 2).until( lambda d: d.find_element_by_name("取消")).click() time.sleep(1) try: dr.tap(random.randint(800, 1000), random.randint(100, 1600)) except: dr.tap(random.randint(550, 700), random.randint(100, 1000)) time.sleep(5) break except TimeoutException: pass return self.do
def menu4(self): dr = self.driver try: self.swipes(300, random.randint(800, 1000), 300, random.randint(400, 600), random.randint(1, 3), 2, 5) self.select_one_by_id( "com.yixia.videoeditor:id/discovery_topic_title") time.sleep(random.randint(5, 10)) for _ in range(random.randint(1, 3)): self.swipes(300, random.randint(800, 1000), 300, random.randint(400, 600), random.randint(0, 2), 2, 5) self.select_one_by_id("com.yixia.videoeditor:id/des") time.sleep(random.randint(10, 15)) #关注 if not random.randint(0, 4): try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/relation")).click() time.sleep(1) WebDriverWait( dr, 2).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/dialog_left_buton") ).click() time.sleep(1) except TimeoutException: pass time.sleep(random.randint(10, 15)) #赞 if not random.randint(0, 4): try: WebDriverWait( dr, 5 ).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/video_good_count_layout") ).click() time.sleep(1) except TimeoutException: pass time.sleep(random.randint(10, 15)) #评论 if not random.randint(0, 19) and self.issign: try: contentnum = WebDriverWait( dr, 10 ).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/feed_video_comment_count" )) if int(contentnum.text) > 10: contentnum.click() time.sleep(5) self.swipes(300, random.randint(800, 1000), 300, random.randint(400, 600), random.randint(2, 10), 2, 2) time.sleep(2) contenttext = WebDriverWait( dr, 30).until(lambda d: d.find_elements_by_id( "com.yixia.videoeditor:id/comment_content") ) comtext = contenttext[random.randint( 0, contenttext.__len__() - 1)].text WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/comment_input") ).click() time.sleep(1) edit = WebDriverWait(dr, 30).until( lambda d: d.find_element_by_class_name( "android.widget.EditText")) edit.send_keys(comtext) time.sleep(1) WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/send_text") ).click() time.sleep(1) WebDriverWait( dr, 30 ).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/detail_title_back") ).click() time.sleep(1) except TimeoutException: pass time.sleep(random.randint(10, 15)) dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) self.readnum -= 1 self.ismenu4 = False except Exception as e: print("error in menu4") return self.exception_returnapp() return self.do
def menu2(self): dr = self.driver city = [ "黑龙江", "吉林", "辽宁", "河北", "山东", "江苏", "安徽", "浙江", "福建", "广东", "海南", "云南", "贵州", "四川", "北京", "天津", "湖北", "河南", "山西", "陕西", "甘肃", "青海", "江西", "台湾", "香港", "澳门", "广西", "内蒙古", "宁夏", "西藏", "新疆", "上海", "重庆" ] try: edts = WebDriverWait( dr, 5).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) edts.send_keys(choice(city)) time.sleep(1) dr.press_keycode(66) time.sleep(5) if random.randint(0, 1): WebDriverWait(dr, 20).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/get_scopes")).click() time.sleep(5) for i in range(random.randint(1, 3)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(random.randint(2, 5)) time.sleep(2) self.select_one_by_id( "com.tujiaapp.tujia:id/scope_cover_image_overlay") time.sleep(random.randint(5, 15)) for i in range(random.randint(10, 15)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(random.randint(5, 10)) #收藏 if not random.randint(0, 4): try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/iv_like")).click() time.sleep(5) except TimeoutException: pass dr.press_keycode(4) time.sleep(2) else: WebDriverWait(dr, 20).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/get_photos")).click() time.sleep(5) for i in range(random.randint(1, 3)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(random.randint(2, 5)) time.sleep(2) self.select_one_by_id("com.tujiaapp.tujia:id/grid_image") time.sleep(random.randint(5, 15)) for i in range(random.randint(10, 15)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(random.randint(5, 10)) #收藏 if not random.randint(0, 4): try: WebDriverWait( dr, 5 ).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/single_media_like_normal") ).click() time.sleep(5) except TimeoutException: pass dr.press_keycode(4) time.sleep(2) dr.press_keycode(4) time.sleep(2) dr.press_keycode(4) time.sleep(2) self.readnum -= 1 self.ismenu2 = False except Exception as e: print("error in menu2") return self.exception_returnapp() return self.do
def signup(self): dr = self.driver pwd_li = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ] self.pwd = "" for _ in range(random.randint(6, 8)): self.pwd += choice(pwd_li) try: #进入注册页面 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/btn_register")).click() time.sleep(1) WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/register_service_agree_holder")).click( ) time.sleep(1) #选择接码平台获取手机号码 # self.phone = self.code.getPhone() self.phone = self.code.getPhone(vno='0') edts = WebDriverWait( dr, 15).until(lambda d: d.find_elements_by_class_name( "android.widget.EditText")) #输入手机号码 edts.send_keys(self.phone) time.sleep(1) #点击获取验证码按钮 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/send_code")).click() time.sleep(5) # try: # dr.find_element_by_name("60s") # print("getMessage failed,try_count:%s" % self.try_count) # #释放号码 # self.code.releasePhone(self.phone) # dr.press_keycode(4) # time.sleep(1) # return self.signup # except NoSuchElementException: # pass #选择接码平台获取验证码 #图加的验证码:6668【图加科技】 regrex = r'验证码:(\d+)' captcha = self.code.waitForMessage(regrex, self.phone) if captcha is None: print("getMessage failed,try_count:%s" % self.try_count) #释放号码 self.code.releasePhone(self.phone) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(1) return self.signup #输入验证码 edts[2].send_keys(captcha) time.sleep(1) #输入密码 edts[3].send_keys(self.pwd) time.sleep(1) edts[0].send_keys(self.get_filemessage("name.txt")) time.sleep(1) #点击完成按钮按钮 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/register")).click() time.sleep(1) #检测注册成功进入下一步 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/control_panel_camera")) return self.after_signup except Exception as e: print("error in getPhone,try_count:%s" % self.try_count) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(2) return self.signup
def signup(self): dr = self.driver pwd_li = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ] self.pwd = "" for _ in range(random.randint(8, 10)): self.pwd += choice(pwd_li) try: #进入注册页面 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/login_btn_register_account") ).click() time.sleep(1) #选择接码平台获取手机号码 self.phone = self.code.getPhone() edts = WebDriverWait( dr, 15).until(lambda d: d.find_elements_by_class_name( "android.widget.EditText")) #输入手机号码 edts[0].send_keys(self.phone) time.sleep(1) #输入密码 edts[1].send_keys(self.pwd) time.sleep(1) edts[2].send_keys(self.pwd) time.sleep(1) #点击获取验证码按钮 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/register_btn_register") ).click() time.sleep(5) try: WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/login_dialog_right") ).click() time.sleep(5) except TimeoutException: print("getMessage failed,try_count:%s" % self.try_count) #释放号码 self.code.releasePhone(self.phone) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(1) return self.signup edts = WebDriverWait( dr, 15).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) #选择接码平台获取验证码 #动态验证码:882371(90秒有效)。您正在进行e帆风顺直销银行用户注册,验证码打死也不能告诉别人哦!【顺德农商银行】 regrex = r'验证码:(\d+)' captcha = self.code.waitForMessage(regrex, self.phone) if captcha is None: print("getMessage failed,try_count:%s" % self.try_count) #释放号码 self.code.releasePhone(self.phone) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.signup #输入验证码 edts.send_keys(captcha) time.sleep(1) #点击完成按钮按钮 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/verify_btn_commit")).click( ) time.sleep(1) #检测注册成功进入下一步 WebDriverWait( dr, 60).until(lambda d: d.find_element_by_name("回到首页")).click() time.sleep(1) return self.after_signup except Exception as e: print("error in getPhone,try_count:%s" % self.try_count) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(2) return self.signup
def do(self): dr = self.driver try: while self.readnum: print("剩下阅读次数:%s" % self.readnum) #随机滑动 self.swipes(300, random.randint(800, 1000), 300, random.randint(400, 600), random.randint(1, 3), 2, 5) #随机选择新闻查看 selectone = WebDriverWait( dr, 10).until(lambda d: d.find_elements_by_id( choice([ "com.shwatch.news:id/homepage_smallText1", "com.shwatch.news:id/homepage_smallText2", "com.shwatch.news:id/homepage_bigText" ]))) selectone[random.randint(0, selectone.__len__() - 1)].click() time.sleep(random.randint(5, 10)) #随机滑动 for x in range(random.randint(1, 4)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(400, 600)) time.sleep(random.randint(2, 10)) #收藏 if random.randint(0, 4) == 0: try: WebDriverWait( dr, 10).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/collection_btn")).click() time.sleep(1) except TimeoutException: pass #喜欢 if random.randint(0, 4) == 0: try: WebDriverWait( dr, 10).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/news_praise")).click() time.sleep(1) except TimeoutException: pass #评论 if random.randint(0, 9) == 0 and self.issign: try: contentnum = WebDriverWait( dr, 10).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/comment_account")) if int(contentnum.text) > 3: contentnum.click() time.sleep(5) self.swipes(300, random.randint(800, 1000), 300, random.randint(400, 600), random.randint(0, 3), 2, 5) contenttext = WebDriverWait( dr, 30).until(lambda d: d.find_elements_by_id( "com.shwatch.news:id/enter_ticket")) time.sleep(1) edit = WebDriverWait(dr, 30).until( lambda d: d.find_element_by_class_name( "android.widget.EditText")) edit.send_keys(contenttext[random.randint( 0, contenttext.__len__() - 1)].text) time.sleep(1) WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/send_message_btn") ).click() time.sleep(1) WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/back_img")).click() time.sleep(1) except TimeoutException: pass dr.press_keycode(4) time.sleep(1) self.readnum -= 1 return self.do except TimeoutException: print("查找菜单出错") return self.exception_returnapp() print("阅览完毕") return self.ends
def after_signup(self): dr = self.driver WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/settingImg")).click() time.sleep(1) WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/userBasicInfoLinearLayout") ).click() time.sleep(1) WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/rl_user_nick_layout")).click() time.sleep(1) #输入昵称 edts = WebDriverWait(dr, 15).until( lambda d: d.find_element_by_class_name("android.widget.EditText")) edts.send_keys(self.get_filemessage("name.txt")) time.sleep(1) WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/btn_title_right_button")).click( ) time.sleep(1) #选择头像 if not random.randint(0, 9): WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/userThumbnail")).click() time.sleep(1) WebDriverWait( dr, 5).until(lambda d: d.find_element_by_name("从相册中选取")).click() time.sleep(1) WebDriverWait( dr, 5).until(lambda d: d.find_element_by_name("文件管理")).click() time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("1")).click() time.sleep(1) WebDriverWait(dr, 15).until( lambda d: d.find_element_by_name("1touxiang")).click() time.sleep(1) for i in range(random.randint(0, 80)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(1) time.sleep(5) self.select_one_by_id("com.android.fileexplorer:id/file_image") time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/ok")).click() time.sleep(5) #保存信息按钮 WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/editInfoConfrimBtn")).click() time.sleep(10) #检测信息保存完毕跳转页面 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.pafinancialtech.shundebank:id/tv_title_back_text")).click() time.sleep(1) #记录帐号密码 try: with open('/sdcard/1/user%s.log' % self.appname_en, 'a') as f: f.write( '\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) except: with open( 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en, 'a') as f: f.write( '\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) time.sleep(1) return self.do
def signup(self): dr = self.driver pwd_li = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] self.pwd = "" for _ in range(random.randint(8, 10)): self.pwd += choice(pwd_li) try: #进入注册页面 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("com.pafinancialtech.jilinbank:id/login_btn_register_account")).click() time.sleep(1) #选择接码平台获取手机号码 self.phone = self.code.getPhone() edts = WebDriverWait(dr, 60).until(lambda d: d.find_elements_by_class_name("android.widget.EditText")) #输入手机号码 edts[0].send_keys(self.phone) time.sleep(1) #输入密码 edts[1].send_keys(self.pwd) time.sleep(1) edts[2].send_keys(self.pwd) time.sleep(1) WebDriverWait(dr, 10).until(lambda d: d.find_element_by_class_name("android.widget.CheckBox")).click() time.sleep(1) #点击获取验证码按钮 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("com.pafinancialtech.jilinbank:id/register_btn_register")).click() time.sleep(5) try: WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("com.pafinancialtech.jilinbank:id/tv_sms")).click() time.sleep(5) except TimeoutException: print("getMessage failed,try_count:%s" % self.try_count) #释放号码 self.code.releasePhone(self.phone) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(1) return self.signup #选择接码平台获取验证码 #【银行一账通】尊敬的用户,您正在进行用户注册,请输入手机验证码177291,有效期:2分钟。 regrex = r'验证码(\d+)' captcha = self.code.waitForMessage(regrex, self.phone) if captcha is None: print("getMessage failed,try_count:%s" % self.try_count) #释放号码 self.code.releasePhone(self.phone) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.signup edts = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_class_name("android.widget.EditText")) #输入验证码 edts.send_keys(captcha) time.sleep(1) #点击完成按钮按钮 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_name("确定")).click() time.sleep(5) #检测注册成功进入下一步 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id("com.pafinancialtech.jilinbank:id/iv_title_right_image")).click() time.sleep(5) dr.press_keycode(4) time.sleep(5) return self.after_signup except Exception as e: print("error in getPhone,try_count:%s" % self.try_count) self.try_count += 1 if self.try_count > 5: return self.exit dr.press_keycode(4) time.sleep(2) return self.signup
def menu1(self): dr = self.driver try: try: WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/tv_info")).click() time.sleep(1) except TimeoutException: pass looknum = random.randint(2, 5) for _ in range(looknum): for i in range(random.randint(0, 2)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(random.randint(2, 5)) self.select_one_by_id("com.tujiaapp.tujia:id/item_tv_title") time.sleep(random.randint(5, 10)) for i in range(random.randint(1, 4)): dr.swipe(300, random.randint(800, 1000), 300, random.randint(300, 600)) time.sleep(random.randint(1, 2)) #点赞 if not random.randint(0, 9): try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/ll_heart")).click() time.sleep(1) except TimeoutException: pass #收藏 if not random.randint(0, 9): try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/iv_like")).click() time.sleep(1) except TimeoutException: pass #评论 if not random.randint(0, 19): try: content = WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/tv_comment_count")) match = re.search(r'(\d+)评论', content.text) contentnum = match.group(1) if int(contentnum) > 5: content.click() time.sleep(5) self.swipes(300, random.randint(800, 1000), 300, random.randint(400, 600), random.randint(2, 10), 2, 2) time.sleep(2) contenttext = WebDriverWait( dr, 30).until(lambda d: d.find_elements_by_id( "com.tujiaapp.tujia:id/tv_content")) comtext = contenttext[random.randint( 0, contenttext.__len__() - 1)].text WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/tv_to_comment") ).click() time.sleep(1) edit = WebDriverWait(dr, 30).until( lambda d: d.find_element_by_class_name( "android.widget.EditText")) edit.send_keys(comtext) time.sleep(1) WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/view_comment_sure") ).click() time.sleep(1) WebDriverWait( dr, 30).until(lambda d: d.find_element_by_id( "com.tujiaapp.tujia:id/iv_close_fragment") ).click() time.sleep(1) except TimeoutException: pass dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) self.readnum -= 1 self.ismenu1 = False except Exception as e: print("error in menu1") return self.exception_returnapp() return self.do
def after_signup(self): dr = self.driver try: WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/user_info")).click() time.sleep(1) #修改名字 if random.randint(0, 1): WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/nickname_layout")).click() time.sleep(1) #输入昵称 edts = WebDriverWait( dr, 15).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) edts.send_keys(self.get_filemessage("name.txt")) time.sleep(1) WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/comfirmed_change")).click() time.sleep(1) #修改头像 if random.randint(0, 9) == 0: copyfile( "/sdcard/1/1touxiang/PIC\ \(%s\).jpg" % random.randint(1, 1000), "/sdcard/2/") time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/mainpage_user_headimg")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/mainpage_btn_picgroup")).click() time.sleep(1) WebDriverWait( dr, 5).until(lambda d: d.find_element_by_name("文件管理")).click() time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("2")).click() time.sleep(1) self.select_one_by_id("com.android.fileexplorer:id/file_image") time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("应用")).click() time.sleep(5) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.shwatch.news:id/btn_callback")).click() time.sleep(1) for x in range(10): dr.press_keycode(4) time.sleep(1) try: WebDriverWait(dr, 2).until( lambda d: d.find_element_by_name("取消")).click() time.sleep(1) try: dr.tap(random.randint(800, 1000), random.randint(100, 1600)) except: dr.tap(random.randint(550, 700), random.randint(100, 1000)) time.sleep(5) break except TimeoutException: pass except: for x in range(10): dr.press_keycode(4) time.sleep(1) try: WebDriverWait(dr, 2).until( lambda d: d.find_element_by_name("取消")).click() time.sleep(1) try: dr.tap(random.randint(800, 1000), random.randint(100, 1600)) except: dr.tap(random.randint(550, 700), random.randint(100, 1000)) time.sleep(5) break except TimeoutException: pass return self.do
def menu1(self): dr = self.driver try: #添加计划 try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_name("添加计划")).click() time.sleep(1) WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/tv_title")) #选择词汇 self.swipes(100, random.randint(800, 1000), 100, random.randint(400, 600), random.randint(0, 1), 1, 1) self.select_one_by_id("com.paoword.www.paoword:id/tv_title") time.sleep(1) self.select_one_by_id("com.paoword.www.paoword:id/typeName2") time.sleep(5) #每天词量/完成天数 for i in range(random.randint(0, 5)): dr.swipe(200, 1160, 200, 1060) time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/btn_ok")).click() time.sleep(5) except TimeoutException: pass #学习 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/begin")).click() time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/layout_expand")).click() time.sleep(1) for x in range(random.randint(10, 20)): try: #拆分单词 if random.randint(0, 4): try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/layout_expand") ).click() time.sleep(random.randint(2, 5)) except TimeoutException: pass #查看视频 if not random.randint(0, 19): try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/tv_btn_connect" )).click() time.sleep(random.randint(5, 15)) except TimeoutException: pass #收藏 if not random.randint(0, 4): try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/actionAddWord") ).click() time.sleep(1) except TimeoutException: pass #笔记 if not random.randint(0, 19) and self.issign: # note = WebDriverWait(dr, 20).until(lambda d: d.find_element_by_id(choice(["com.paoword.www.paoword:id/memory_dec", "com.paoword.www.paoword:id/memory_assistance"]))).text WebDriverWait( dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/note")).click() time.sleep(1) self.swipes(300, random.randint(800, 1000), 300, random.randint(400, 600), random.randint(0, 2), 1, 2) time.sleep(1) try: contenttext = WebDriverWait( dr, 10 ).until(lambda d: d.find_elements_by_id( "com.paoword.www.paoword:id/tv_expandable_text" )) note = contenttext[random.randint( 0, contenttext.__len__() - 1)].text WebDriverWait( dr, 15 ).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/tv_btn_write_note") ).click() time.sleep(1) edts = WebDriverWait( dr, 15 ).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/et_note_content")) edts.send_keys(note) time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/btn_right") ).click() time.sleep(1) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/actionBack") ).click() time.sleep(1) except TimeoutException: dr.press_keycode(4) time.sleep(1) time.sleep(random.randint(2, 5)) #检测学习完成 try: WebDriverWait( dr, 2).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/img_btn_back")) time.sleep(1) break except TimeoutException: pass #泡/爆 if random.randint(0, 4): WebDriverWait( dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/next")).click() time.sleep(1) else: WebDriverWait( dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/ignore")).click() time.sleep(1) except TimeoutException: break dr.press_keycode(4) time.sleep(5) dr.press_keycode(4) time.sleep(1) #复习 if random.randint(0, 1): WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/redo")).click() time.sleep(1) for x in range(random.randint(2, 5)): time.sleep(random.randint(2, 5)) #提示 if not random.randint(0, 4): try: WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( "com.paoword.www.paoword:id/reminder_image" )).click() time.sleep(2) except TimeoutException: pass try: ans = WebDriverWait( dr, 5).until(lambda d: d.find_element_by_id( choice([ "com.paoword.www.paoword:id/item1_margin", "com.paoword.www.paoword:id/item2_margin", "com.paoword.www.paoword:id/item3_margin", "com.paoword.www.paoword:id/item4_margin" ]))) dr.tap(ans.location['x'] + 5, ans.location['y'] + 5) time.sleep(1) except TimeoutException: dr.press_keycode(4) time.sleep(5) break dr.press_keycode(4) time.sleep(1) self.ismenu1 = False except Exception as e: print("error in menu1") return self.exception_returnapp() return self.do
def signup(self): dr = self.driver WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/login_weibo_button")).click() time.sleep(1) #进入微博登录界面 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.sina.weibo:id/etLoginUsername")) time.sleep(1) try: with open('/sdcard/1/weibo.txt', 'r', encoding='utf-8') as f: tfile = "/sdcard/1/weibo.txt" strqq = f.read() except: with open('D:/brush/slave/scripts/doc/weibo.txt', 'r', encoding='utf-8') as f: tfile = "D:/brush/slave/scripts/doc/weibo.txt" strqq = f.read() match = re.search(r'notuse,([0-9a-zA-Z\.\@]+,[0-9a-zA-Z\_\@]+)', strqq) if match: self.phone = re.search(r'notuse,([0-9a-zA-Z\.\@]+)', match.group(0)).group(1) self.pwd = re.search(r'notuse,[0-9a-zA-Z\.\@]+,([0-9a-zA-Z\_\@]+)', match.group(0)).group(1) #修改标志QQ已使用 try: lines = open(tfile, 'r').readlines() flen = len(lines) for i in range(flen): if match.group(0) in lines[i]: usetime = '(time %s.%s %s:%s:%s)' % ( time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec) modify = 'use,' + match.group(1) + " " + usetime lines[i] = lines[i].replace(match.group(0), modify) break open(tfile, 'w').writelines(lines) except Exception as e: print(e) else: #帐号已用完 dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.do edit = WebDriverWait(dr, 15).until( lambda d: d.find_elements_by_class_name("android.widget.EditText")) edit[0].send_keys(self.phone) time.sleep(1) edit[1].send_keys(self.pwd) time.sleep(1) WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id( "com.sina.weibo:id/bnLogin")).click() time.sleep(5) try: for _ in range(5): WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.sina.weibo:id/iv_access_image")) time.sleep(5) screenshot("/sdcard/screenshot.png") run_qpy2_script("get_captchaimg_sina.py") imgcaptcha = self.uuwise() if imgcaptcha is None: print("getimgcaptcha failed") self.try_count += 1 if self.try_count > 5: self.try_count = 0 return self.exit dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.signup edts = WebDriverWait( dr, 15).until(lambda d: d.find_element_by_class_name( "android.widget.EditText")) edts.send_keys(imgcaptcha) WebDriverWait( dr, 15).until(lambda d: d.find_element_by_name("确定")).click() time.sleep(5) try: #图片验证码是否正确 WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id( "com.sina.weibo:id/iv_access_image")) time.sleep(1) except TimeoutException: break #注册成功页面检测 WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id( "com.sina.weibo:id/bnLogin")).click() time.sleep(1) WebDriverWait(dr, 120).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/titleLeft")).click() time.sleep(1) #记录帐号密码 try: with open('/sdcard/1/user%s.log' % self.appname_en, 'a') as f: f.write('\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) except: with open( 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en, 'a') as f: f.write('\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) time.sleep(1) self.issign = True except TimeoutException: try: WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id( "com.sina.weibo:id/bnLogin")).click() time.sleep(1) WebDriverWait(dr, 120).until(lambda d: d.find_element_by_id( "com.yixia.videoeditor:id/titleLeft")).click() time.sleep(1) #记录帐号密码 try: with open('/sdcard/1/user%s.log' % self.appname_en, 'a') as f: f.write( '\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) except: with open( 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en, 'a') as f: f.write( '\nimei:%s,%s,%s (time %s.%s %s:%s:%s)' % (self.imei, self.phone, self.pwd, time.localtime().tm_mon, time.localtime().tm_mday, time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)) time.sleep(1) self.issign = True return self.do except TimeoutException: pass #修改标志QQ使用失败 try: lines = open(tfile, 'r').readlines() flen = len(lines) for i in range(flen): if modify in lines[i]: lines[i] = lines[i].replace(modify, modify + ',false') break open(tfile, 'w').writelines(lines) except Exception as e: print(e) screenshot( "/sdcard/error/%s.png" % (str(time.localtime().tm_mon) + str(time.localtime().tm_mday) + str(time.localtime().tm_hour) + str(time.localtime().tm_min) + str(time.localtime().tm_sec))) time.sleep(5) self.try_count += 1 if self.try_count > 5: self.try_count = 0 return self.exit dr.press_keycode(4) time.sleep(1) dr.press_keycode(4) time.sleep(1) return self.signup return self.do