コード例 #1
0
    def begin(self):
        dr = self.driver
        dr.press_keycode(3)
        time.sleep(1)
        WebDriverWait(
            dr,
            30).until(lambda d: d.find_element_by_name(self.appname)).click()
        time.sleep(10)
        #检测已进入app
        WebDriverWait(dr, 60).until(
            lambda d: d.find_element_by_id("com.sports.baofeng:id/tv_me"))
        self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                          time.localtime().tm_min,
                                          time.localtime().tm_sec)
        time.sleep(1)
        #注册率
        sign_rate = random.randint(1, 10000)
        if sign_rate <= 2000:
            WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
                "com.sports.baofeng:id/tv_me")).click()
            time.sleep(1)
            WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
                "com.sports.baofeng:id/iv_baofeng_login")).click()
            time.sleep(1)
            return self.login_code_platform

        return self.do
コード例 #2
0
 def login(self):
     dr = self.driver
     try:
         with open('/sdcard/1/user%s.log' % self.appname_en, 'r') as f:
             selectuser = f.read()
     except:
         with open(
                 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en,
                 'r') as f:
             selectuser = f.read()
     user = re.search(r'imei:%s,(\d+)' % self.imei, selectuser)
     pwd = re.search(r'imei:%s,\d+,([0-9a-z]+)' % self.imei, selectuser)
     if user and pwd:
         WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
             "com.sports.baofeng:id/tv_me")).click()
         time.sleep(1)
         WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
             "com.sports.baofeng:id/iv_baofeng_login")).click()
         time.sleep(1)
         edit = WebDriverWait(
             dr, 60).until(lambda d: d.find_elements_by_class_name(
                 "android.widget.EditText"))
         edit[0].send_keys(str(user.group(1)))
         time.sleep(1)
         edit[1].send_keys(str(pwd.group(1)))
         time.sleep(1)
         WebDriverWait(dr, 5).until(lambda d: d.find_element_by_xpath(
             "//android.view.View[@content-desc='登录 Link']")).click()
         time.sleep(1)
         WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(
             "com.sports.baofeng:id/tv_me")).click()
         time.sleep(1)
     time.sleep(5)
     return self.do
コード例 #3
0
ファイル: primary008.py プロジェクト: cash2one/brush-1
 def setup_dir(self):
     dr = self.driver
     dr.press_keycode(4)
     time.sleep(1)
     ##008修改数据的图标
     WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
         "com.soft.apk008v:id/main_centerImg")).click()
     time.sleep(1)
     WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("随机生成"))
     # WebDriverWait(dr, 5).until(lambda d: d.find_element_by_name("历史记录")).click()
     # time.sleep(0.5)
     # WebDriverWait(dr, 5).until(lambda d: d.find_element_by_class_name("android.widget.ImageButton")).click()
     # time.sleep(0.5)
     # WebDriverWait(dr, 5).until(lambda d: d.find_element_by_name("新建分类")).click()
     # time.sleep(0.5)
     # edt = WebDriverWait(dr, 15).until(lambda d: d.find_element_by_class_name("android.widget.EditText"))
     # edt.send_keys(self.tmpfile)
     # time.sleep(0.5)
     # WebDriverWait(dr, 5).until(lambda d: d.find_element_by_name("确定")).click()
     # time.sleep(0.5)
     # WebDriverWait(dr, 5).until(lambda d: d.find_element_by_name("切换分类")).click()
     # time.sleep(0.5)
     # WebDriverWait(dr, 5).until(lambda d: d.find_element_by_name(self.tmpfile)).click()
     # time.sleep(1)
     # dr.press_keycode(4)
     # time.sleep(1)
     return self.get_data_from_server()
コード例 #4
0
 def recovery_app(self):
     dr = self.driver
     dr.find_element_by_name("工具箱").click()
     time.sleep(1)
     try:
         #提取备份文件
         copyfile("/sdcard/008backUp2/*__%s" % self.imei,
                  "/sdcard/008backUp/")
         time.sleep(5)
         removefile("/sdcard/008backUp2/*__%s" % self.imei)
         time.sleep(5)
         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(self.imei)).click()
         time.sleep(1)
         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_name(self.imei))
     except TimeoutException:
         pass
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.do_toolbox_task
コード例 #5
0
ファイル: machineMiaopai.py プロジェクト: cash2one/brush-1
    def begin(self):
        dr = self.driver
        dr.press_keycode(3)
        time.sleep(1)
        WebDriverWait(
            dr,
            30).until(lambda d: d.find_element_by_name(self.appname)).click()
        time.sleep(10)
        #检测已进入app
        WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(
            "com.yixia.videoeditor:id/bottom_record_top"))
        self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                          time.localtime().tm_min,
                                          time.localtime().tm_sec)
        time.sleep(1)
        #注册率
        sign_rate = random.randint(1, 10000)
        if sign_rate <= 3000:
            WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
                "com.yixia.videoeditor:id/bottom_my_lay")).click()
            time.sleep(1)
            WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
                "com.yixia.videoeditor:id/no_login_views")).click()
            time.sleep(1)
            return self.signup

        return self.do
コード例 #6
0
ファイル: machinePaodanci.py プロジェクト: cash2one/brush-1
 def do(self):
     dr = self.driver
     try:
         if self.ismenu1:
             print("goto menu1")
             WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
                 "com.paoword.www.paoword:id/rbtn_index")).click()
             time.sleep(5)
             return self.menu1
         if self.ismenu2 and self.issign and random.randint(0, 1):
             print("goto menu2")
             WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
                 "com.paoword.www.paoword:id/rbtn_arena")).click()
             time.sleep(5)
             return self.menu2
         if self.ismenu3 and self.issign and random.randint(0, 1):
             print("goto menu3")
             WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
                 "com.paoword.www.paoword:id/rbtn_personal_center")).click(
                 )
             time.sleep(5)
     except TimeoutException:
         print("查找菜单出错")
         return self.exception_returnapp()
     print("阅览完毕")
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.ends
コード例 #7
0
 def begin(self):
     dr = self.driver
     dr.press_keycode(3)
     time.sleep(1)
     WebDriverWait(
         dr,
         30).until(lambda d: d.find_element_by_name(self.appname)).click()
     time.sleep(10)
     try:
         WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
             "com.shwatch.news:id/sdl__content"))
         time.sleep(1)
         dr.press_keycode(4)
         time.sleep(1)
     except TimeoutException:
         pass
     #检测已进入app
     WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
         "com.shwatch.news:id/slideMenu_homepage"))
     self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                       time.localtime().tm_min,
                                       time.localtime().tm_sec)
     time.sleep(1)
     if not self.readnum:
         time.sleep(random.randint(10, 20))
         return self.ends()
     return self.login
コード例 #8
0
 def menu4(self):
     dr = self.driver
     try:
         try:
             WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id(
                 "com.qq.ac.android:id/iv_guide_setting")).click()
             time.sleep(1)
             dr.press_keycode(4)
             time.sleep(1)
         except TimeoutException:
             pass
         if random.randint(0, 1):
             try:
                 WebDriverWait(dr, 5).until(
                     lambda d: d.find_element_by_name("签到")).click()
                 time.sleep(5)
                 dr.tap(360, 1000)
                 time.sleep(5)
                 WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
                     "com.qq.ac.android:id/btn_actionbar_back")).click()
                 time.sleep(1)
             except TimeoutException:
                 pass
         self.ismenu4 = False
     except Exception as e:
         print("error in menu4")
         return self.exception_returnapp()
     return self.do
コード例 #9
0
ファイル: machine008.py プロジェクト: cash2one/brush-1
    def enter_008(self):
        print("enter 008")
        dr = self.driver
        dr.press_keycode(3)  # back to Home
        time.sleep(1)
        dr.press_keycode(3)  # back to Home
        time.sleep(1)
        dr.find_element_by_name("008神器0301").click()
        try:
            WebDriverWait(dr, 10).until(lambda d: d.find_element_by_name("请检查当前网络是否可用"))
            time.sleep(1)
            WebDriverWait(dr, 10).until(lambda d: d.find_element_by_name("确定")).click()
            time.sleep(1)
            return self.onEnterException
        except TimeoutException:
            pass
        try:
            WebDriverWait(dr, 5).until(lambda d: d.find_element_by_name("确定")).click()
            return self.onEnterException
        except TimeoutException:
            pass
        try:
            toolbox = WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("工具箱"))
            # toolbox.click()
        except TimeoutException:
            return self.onEnterException

        return self.enter_toolbox
コード例 #10
0
 def reconnect(self):
     dr = self.driver
     time.sleep(2)
     #切换VPN
     button_connect = WebDriverWait(
         dr,
         30).until(lambda d: d.find_element_by_id("org.wuji:id/exit_vpn"))
     button_connect.click()
     time.sleep(1)
     # try:
     #     dr.find_element_by_name("正在初始化数据").click()
     #     time.sleep(5)
     # except NoSuchElementException:
     #     pass
     # try:
     #     dr.find_element_by_name("启动失败")
     #     button_connect.click()
     #     time.sleep(5)
     # except NoSuchElementException:
     #     pass
     #检测连接成功
     try:
         WebDriverWait(dr, 15).until(
             lambda d: d.find_element_by_id("com.miui.home:id/cell_layout"))
     except TimeoutException:
         return self.onConnectTimeout
     self.reconnect_times = 0
     return self.exit
コード例 #11
0
ファイル: machineZijin.py プロジェクト: cash2one/brush-1
    def begin(self):
        dr = self.driver
        dr.press_keycode(3)
        time.sleep(1)
        WebDriverWait(
            dr,
            30).until(lambda d: d.find_element_by_name(self.appname)).click()
        time.sleep(10)
        #检测已进入app
        WebDriverWait(dr, 60).until(
            lambda d: d.find_element_by_class_name("android.widget.ImageView"))
        self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                          time.localtime().tm_min,
                                          time.localtime().tm_sec)
        time.sleep(1)
        #新开软件翻页
        self.swipes(600, 300, 300, 300, 1, 2, 2)
        WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
            "com.pafinancialtech.zijinbank:id/head_icon"))
        dr.tap(80, 1250)
        time.sleep(1)
        #注册率
        sign_rate = random.randint(1, 10000)
        if sign_rate <= 10000:
            WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
                "com.pafinancialtech.zijinbank:id/head_image")).click()
            time.sleep(1)
            return self.login_code_platform

        return self.do
コード例 #12
0
 def begin(self):
     dr = self.driver
     dr.press_keycode(3)
     time.sleep(1)
     WebDriverWait(
         dr,
         30).until(lambda d: d.find_element_by_name(self.appname)).click()
     time.sleep(10)
     #检测更新
     try:
         WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
             "com.paoword.www.paoword:id/negative")).click()
         time.sleep(1)
     except TimeoutException:
         pass
     #检测已进入app
     WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(
         "com.paoword.www.paoword:id/btn_login_enter"))
     self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                       time.localtime().tm_min,
                                       time.localtime().tm_sec)
     time.sleep(1)
     #注册率
     sign_rate = random.randint(1, 10000)
     if sign_rate <= 10000:
         return self.login_code_platform
     WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
         "com.paoword.www.paoword:id/btn_login_enter")).click()
     time.sleep(1)
     WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
         "com.paoword.www.paoword:id/btn_visitor_login")).click()
     time.sleep(1)
     return self.do
コード例 #13
0
ファイル: machineZijin.py プロジェクト: cash2one/brush-1
 def login(self):
     dr = self.driver
     try:
         with open('/sdcard/1/user%s.log' % self.appname_en, 'r') as f:
             selectuser = f.read()
     except:
         with open(
                 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en,
                 'r') as f:
             selectuser = f.read()
     user = re.search(r'imei:%s,(\d+)' % self.imei, selectuser)
     pwd = re.search(r'imei:%s,\d+,([0-9a-z]+)' % self.imei, selectuser)
     if user and pwd:
         WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
             "com.pafinancialtech.zijinbank:id/head_image")).click()
         time.sleep(1)
         edit = WebDriverWait(
             dr, 15).until(lambda d: d.find_elements_by_class_name(
                 "android.widget.EditText"))
         edit[0].send_keys(str(user.group(1)))
         time.sleep(1)
         edit[1].send_keys(str(pwd.group(1)))
         time.sleep(1)
         WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
             "com.pafinancialtech.zijinbank:id/login_btn_login")).click()
         time.sleep(5)
         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
     time.sleep(5)
     return self.do
コード例 #14
0
ファイル: machine008.py プロジェクト: cash2one/brush-1
def change_date_dir(driver):
    dr = driver
    dr.press_keycode(3)  # back to Home
    time.sleep(1)
    dr.press_keycode(3)  # back to Home
    time.sleep(1)
    dr.find_element_by_name("008神器0301").click()
    WebDriverWait(dr, 30).until(
        lambda d: d.find_element_by_id("com.soft.apk008v:id/main_centerImg")).click()  ##008修改数据的图标
    WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("随机生成")).click()
    time.sleep(1)
    dr.find_element_by_name("保存").click()
    time.sleep(2)
    try:
        dr.find_element_by_name("确定").click()
    except Exception as e:
        pass
    time.sleep(1)

    dr.press_keycode(4)  # keypress back
    time.sleep(0.5)
    dr.press_keycode(4)  # keypress back
    time.sleep(0.5)
    dr.find_element_by_name("确定").click()
    time.sleep(1)
    print("Something has changed")
コード例 #15
0
 def recovery_app_lib(self):
     dr = self.driver
     try:
         #提取备份文件
         copyfile("/sdcard/008backUp2/*__%s" % self.imei,
                  "/sdcard/008backUp/")
         time.sleep(2)
         copyfile("/sdcard/lib", "/sdcard/008backUp/*/*/")
         time.sleep(2)
         removefile("/sdcard/008backUp2/*__%s" % self.imei)
         time.sleep(5)
         WebDriverWait(
             dr,
             5).until(lambda d: d.find_element_by_name("备份程序数据")).click()
         time.sleep(1)
         dr.find_element_by_name(self.imei).click()
         time.sleep(1)
         WebDriverWait(
             dr, 5).until(lambda d: d.find_element_by_name("还原")).click()
         time.sleep(5)
         #检测还原成功
         WebDriverWait(
             dr, 30).until(lambda d: d.find_element_by_name(self.imei))
     except:
         dr.press_keycode(4)
         time.sleep(1)
     dr.press_keycode(4)  # keypress back
     time.sleep(1)
     return self.do_toolbox_task
コード例 #16
0
 def backup_app_lib(self):
     dr = self.driver
     dr.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,
                   5).until(lambda d: d.find_element_by_name("备份")).click()
     time.sleep(5)
     #检测备份完成
     WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("备份"))
     #删除lib文件
     removefile("/sdcard/008backUp/*/*/lib")
     time.sleep(2)
     #移动备份文件
     copyfile("/sdcard/008backUp/*", "/sdcard/008backUp2/")
     time.sleep(5)
     removefile("/sdcard/008backUp/*")
     time.sleep(5)
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.do_toolbox_task
コード例 #17
0
 def login(self):
     dr = self.driver
     try:
         with open('/sdcard/1/user%s.log' % self.appname_en, 'r') as f:
             selectuser = f.read()
     except:
         with open(
                 'D:/brush/slave/scripts/doc/user%s.log' % self.appname_en,
                 'r') as f:
             selectuser = f.read()
     user = re.search(r'imei:%s,(\d+)' % self.imei, selectuser)
     pwd = re.search(r'imei:%s,\d+,([0-9a-z]+)' % self.imei, selectuser)
     if user and pwd:
         edit = WebDriverWait(
             dr, 15).until(lambda d: d.find_elements_by_class_name(
                 "android.widget.EditText"))
         edit[0].send_keys(str(user.group(1)))
         time.sleep(1)
         edit[1].send_keys(str(pwd.group(1)))
         time.sleep(1)
         WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
             "com.tujiaapp.tujia:id/btn_login")).click()
         time.sleep(5)
         WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(
             "com.tujiaapp.tujia:id/control_panel_camera"))
         return self.do
     time.sleep(random.randint(15, 30))
     return self.ends
コード例 #18
0
 def exception_returnapp(self):
     dr = self.driver
     print("try_count:%s" % self.try_count)
     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)
     dr.press_keycode(82)
     time.sleep(2)
     try:
         WebDriverWait(dr, 2).until(
             lambda d: d.find_element_by_name(self.appname)).click()
     except TimeoutException:
         dr.press_keycode(4)
     time.sleep(5)
     try:
         WebDriverWait(
             dr, 5).until(lambda d: d.find_element_by_name("残忍拒绝")).click()
         time.sleep(1)
     except TimeoutException:
         pass
     return self.do
コード例 #19
0
    def begin(self):
        dr = self.driver
        dr.press_keycode(3)
        time.sleep(1)
        WebDriverWait(
            dr,
            30).until(lambda d: d.find_element_by_name(self.appname)).click()
        time.sleep(10)
        try:
            WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
                "com.shwatch.news:id/sdl__content"))
            time.sleep(1)
            dr.press_keycode(4)
            time.sleep(1)
        except TimeoutException:
            pass
        #检测已进入app
        WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
            "com.shwatch.news:id/slideMenu_homepage"))
        self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                          time.localtime().tm_min,
                                          time.localtime().tm_sec)
        time.sleep(1)
        #注册率
        sign_rate = random.randint(1, 10000)
        if sign_rate <= 1000:
            WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
                "com.shwatch.news:id/user_btn")).click()
            time.sleep(1)
            WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
                "com.shwatch.news:id/login_btn")).click()
            time.sleep(1)
            return self.login_code_platform

        return self.do
コード例 #20
0
 def do(self):
     dr = self.driver
     try:
         while self.readnum:
             print("剩下阅读次数:%s" % self.readnum)
             random_read = random.randint(0, 2)
             if random_read == 0:
                 if self.ismenu1:
                     print("goto menu1")
                     try:
                         WebDriverWait(
                             dr, 15).until(lambda d: d.find_elements_by_id(
                                 "android.widget.ImageButton"))[0].click()
                         time.sleep(5)
                         time.sleep(random.randint(15, 30))
                     except TimeoutException:
                         pass
                     self.readnum -= 1
                     self.ismenu1 = False
                 return self.do
             elif random_read == 1:
                 if self.ismenu2:
                     print("goto menu2")
                     try:
                         WebDriverWait(
                             dr, 15).until(lambda d: d.find_elements_by_id(
                                 "android.widget.ImageButton"))[1].click()
                         time.sleep(5)
                         time.sleep(random.randint(15, 30))
                     except TimeoutException:
                         pass
                     self.readnum -= 1
                     self.ismenu2 = False
                 return self.do
             else:
                 if self.ismenu3:
                     print("goto menu3")
                     try:
                         WebDriverWait(
                             dr, 15).until(lambda d: d.find_elements_by_id(
                                 "android.widget.ImageButton"))[2].click()
                         time.sleep(5)
                         time.sleep(random.randint(15, 30))
                     except TimeoutException:
                         pass
                     self.readnum -= 1
                     self.ismenu3 = False
                 return self.do
     except TimeoutException:
         print("查找菜单出错")
         return self.exception_returnapp()
     print("阅览完毕")
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.ends
コード例 #21
0
ファイル: machinePaodanci.py プロジェクト: cash2one/brush-1
 def begin(self):
     dr = self.driver
     dr.press_keycode(3)
     time.sleep(1)
     WebDriverWait(
         dr,
         30).until(lambda d: d.find_element_by_name(self.appname)).click()
     time.sleep(10)
     #检测更新
     try:
         WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id(
             "com.paoword.www.paoword:id/negative")).click()
         time.sleep(1)
     except TimeoutException:
         pass
     #帐号其他地方登录
     try:
         WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id(
             "com.paoword.www.paoword:id/positive")).click()
         time.sleep(1)
         WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
             "com.paoword.www.paoword:id/btn_visitor_login")).click()
         time.sleep(5)
     except TimeoutException:
         pass
     #检查广告
     try:
         WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id(
             "com.paoword.www.paoword:id/ivClose")).click()
         time.sleep(1)
     except TimeoutException:
         pass
     try:
         WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id(
             "com.paoword.www.paoword:id/btn_login_enter")).click()
         time.sleep(1)
         WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id(
             "com.paoword.www.paoword:id/btn_visitor_login")).click()
         time.sleep(1)
     except TimeoutException:
         pass
     #检测已进入app
     WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(
         "com.paoword.www.paoword:id/rbtn_index"))
     self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour,
                                       time.localtime().tm_min,
                                       time.localtime().tm_sec)
     time.sleep(1)
     #检测是否已注册
     WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(
         "com.paoword.www.paoword:id/rbtn_personal_center")).click()
     try:
         WebDriverWait(dr, 5).until(lambda d: d.find_element_by_id(
             "com.paoword.www.paoword:id/positive")).click()
         time.sleep(1)
     except TimeoutException:
         self.issign = True
     return self.do
コード例 #22
0
 def main_loop(self):
     dr = self.driver
     m008 = self.machine008
     while True:
         try:
             dr.press_keycode(3)
             time.sleep(1)
             dr.press_keycode(3)
             time.sleep(1)
             #清后台
             # dr.press_keycode(82)
             # time.sleep(1)
             # WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("com.android.systemui:id/clearButton")).click()
             # time.sleep(1)
             MachineVPN(dr).run()
             m008.run()
             # dr.press_keycode(3)
             # time.sleep(1)
             # dr.press_keycode(3)
             # time.sleep(1)
             # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name(self.appname)).click()
             # time.sleep(5)
             # 开启加速
             # dr.press_keycode(3)
             # time.sleep(1)
             # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("GMD Speed Time")).click()
             # time.sleep(1)
             # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id("com.gmd.speedtime:id/buttonStart")).click()
             # time.sleep(2)
             dr.press_keycode(3)
             time.sleep(1)
             WebDriverWait(dr, 30).until(
                 lambda d: d.find_element_by_name(self.appname)).click()
             time.sleep(15)
             #记录ip
             self.log_ip()
             dr.press_keycode(3)
             time.sleep(5)
             WebDriverWait(dr, 30).until(
                 lambda d: d.find_element_by_name(self.appname)).click()
             time.sleep(1)
             #关闭加速
             # dr.press_keycode(3)
             # time.sleep(1)
             # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("嘀嗒拼车")).click()
             # time.sleep(5)
             # WebDriverWait(dr, 30).until(lambda d: d.find_element_by_id("com.gmd.speedtime:id/buttonStop")).click()
             # time.sleep(1)
             # dr.press_keycode(3)
             # time.sleep(1)
         except Exception as e:
             print("somting wrong")
             print(e)
         finally:
             pass
         print("Again\n")
     return self.exit
コード例 #23
0
 def do(self):
     dr = self.driver
     try:
         while self.readnum:
             print("剩下阅读次数:%s" % self.readnum)
             random_read = random.randint(0, 3)
             if random_read == 0:
                 if self.ismenu1:
                     print("goto menu1")
                     WebDriverWait(
                         dr, 15).until(lambda d: d.find_element_by_id(
                             "com.qq.ac.android:id/tab_icon_recommend")
                                       ).click()
                     time.sleep(5)
                     return self.menu1
                 return self.do
             elif random_read == 1:
                 if self.ismenu2:
                     print("goto menu2")
                     WebDriverWait(
                         dr, 15).until(lambda d: d.find_element_by_id(
                             "com.qq.ac.android:id/tab_icon_bookshelf")
                                       ).click()
                     time.sleep(5)
                     return self.menu2
                 return self.do
             elif random_read == 2:
                 if self.ismenu3:
                     print("goto menu3")
                     WebDriverWait(
                         dr, 15).until(lambda d: d.find_element_by_id(
                             "com.qq.ac.android:id/tab_icon_square")).click(
                             )
                     time.sleep(5)
                     return self.menu3
                 return self.do
             else:
                 if self.ismenu4:
                     print("goto menu4")
                     WebDriverWait(
                         dr, 15).until(lambda d: d.find_element_by_id(
                             "com.qq.ac.android:id/tab_icon_center")).click(
                             )
                     time.sleep(5)
                     return self.menu4
                 return self.do
     except TimeoutException:
         print("查找菜单出错")
         return self.exception_returnapp()
     print("阅览完毕")
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.ends
コード例 #24
0
ファイル: machineX.py プロジェクト: cash2one/brush-1
 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("")).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)
         #点击获取验证码按钮
         WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("")).click()
         time.sleep(5)
         #输入密码
         edts[2].send_keys(self.pwd)
         time.sleep(1)
         #选择接码平台获取验证码
         #【友寻】您的临时验证码为:302855,有效时间为30分钟。
         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[1].send_keys(captcha)
         time.sleep(1)
         #点击完成按钮按钮
         WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id("")).click()
         time.sleep(1)
         #检测注册成功进入下一步
         WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id(""))
         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
コード例 #25
0
    def ends(self):
        dr = self.driver
        #二次打开
        for x in range(random.randint(0, 1)):
            dr.press_keycode(3)
            time.sleep(1)
            dr.press_keycode(3)
            time.sleep(30)
            WebDriverWait(dr, 2).until(
                lambda d: d.find_element_by_name(self.appname)).click()
            time.sleep(1)
        #记录时间
        self.endstime = "结束:%s:%s:%s" % (time.localtime().tm_hour,
                                         time.localtime().tm_min,
                                         time.localtime().tm_sec)
        print(self.begintime)
        print(self.endstime)
        time.sleep(2)
        try:
            with open('/sdcard/1/time%s.log' % self.appname_en, 'a') as f:
                f.write('\n激活 %s.%s, %s, %s, count:%s' %
                        (time.localtime().tm_mon, time.localtime().tm_mday,
                         self.begintime, self.endstime, self.runnum))
        except:
            pass
        time.sleep(3)
        #加速器
        dr.press_keycode(3)
        time.sleep(1)
        dr.press_keycode(3)
        time.sleep(1)
        WebDriverWait(dr, 10).until(
            lambda d: d.find_element_by_name("GMD Speed Time")).click()
        time.sleep(1)
        try:
            WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id(
                "com.gmd.speedtime:id/buttonStop")).click()
            time.sleep(1)
        except TimeoutException:
            WebDriverWait(dr, 5).until(
                lambda d: d.find_element_by_name("No, thanks")).click()
            time.sleep(1)
            WebDriverWait(dr, 10).until(lambda d: d.find_element_by_id(
                "com.gmd.speedtime:id/buttonStop")).click()
            time.sleep(1)
        dr.press_keycode(3)
        time.sleep(1)
        #效率控制
        # st = [1200, 1200, 1200, 1200, 1200, 1200, 180, 120, 40, 20, 10, 10,
        #       10, 20, 20, 20, 10, 10, 5, 0, 0, 0, 0, 0]
        #
        # print("现在时间是%s:%s,脚本将在%s秒后继续执行" % (time.localtime().tm_hour, time.localtime().tm_min, st[time.localtime().tm_hour-1]))
        # time.sleep(st[time.localtime().tm_hour-1])

        return self.exit
コード例 #26
0
ファイル: machineJiyin.py プロジェクト: cash2one/brush-1
 def begin(self):
     dr = self.driver
     dr.press_keycode(3)
     time.sleep(1)
     WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name(self.appname)).click()
     time.sleep(10)
     #检测已进入app
     WebDriverWait(dr, 60).until(lambda d: d.find_element_by_id("com.pafinancialtech.jilinbank:id/skip_btn")).click()
     self.begintime = "开始:%s:%s:%s" % (time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)
     time.sleep(1)
     return self.login
コード例 #27
0
ファイル: machine008.py プロジェクト: cash2one/brush-1
 def modify_data(self):
     dr = self.driver
     btmodify = WebDriverWait(dr, 30).until(lambda d: d.find_elements_by_class_name("android.widget.ImageView"))
     btmodify[1].click()
     time.sleep(1)
     dr.find_element_by_name("从网络获取数据").click()
     save = WebDriverWait(dr, 30).until(lambda d: d.find_element_by_name("保存"))
     save.click()
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.do_toolbox_task
コード例 #28
0
ファイル: machineX.py プロジェクト: cash2one/brush-1
 def do(self):
     dr = self.driver
     try:
         while self.readnum:
             print("剩下阅读次数:%s" % self.readnum)
             random_read = random.randint(0, 4)
             if random_read == 0:
                 if self.ismenu1:
                     print("goto menu1")
                     WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("")).click()
                     time.sleep(5)
                     return self.menu1
                 return self.do
             elif random_read == 1:
                 if self.ismenu2:
                     print("goto menu2")
                     WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("")).click()
                     time.sleep(5)
                     return self.menu2
                 return self.do
             elif random_read == 2:
                 if self.ismenu3:
                     print("goto menu3")
                     WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("")).click()
                     time.sleep(5)
                     return self.menu3
                 return self.do
             elif random_read == 3:
                 if self.ismenu4:
                     print("goto menu4")
                     WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("")).click()
                     time.sleep(5)
                     return self.menu4
                 return self.do
             else:
                 if self.ismenu5:
                     print("goto menu5")
                     WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id("")).click()
                     time.sleep(5)
                     return self.menu5
                 return self.do
     except TimeoutException:
         print("查找菜单出错")
         return self.exception_returnapp()
     print("阅览完毕")
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     dr.press_keycode(4)
     time.sleep(1)
     return self.ends
コード例 #29
0
ファイル: machinePaodanci.py プロジェクト: cash2one/brush-1
 def menu2(self):
     dr = self.driver
     try:
         WebDriverWait(
             dr,
             15).until(lambda d: d.find_element_by_name("双人竞技")).click()
         time.sleep(5)
         for x in range(15):
             try:
                 WebDriverWait(dr, 15).until(lambda d: d.find_element_by_id(
                     choice([
                         "com.paoword.www.paoword:id/option_view_1",
                         "com.paoword.www.paoword:id/option_view_2",
                         "com.paoword.www.paoword:id/option_view_3",
                         "com.paoword.www.paoword:id/option_view_4"
                     ]))).click()
                 WebDriverWait(
                     dr, 10).until_not(lambda d: d.find_element_by_id(
                         "com.paoword.www.paoword:id/option_view_1"))
                 time.sleep(random.randint(1, 3))
             except TimeoutException:
                 try:
                     WebDriverWait(
                         dr, 5).until(lambda d: d.find_element_by_id(
                             "com.paoword.www.paoword:id/ibtn_back")).click(
                             )
                     time.sleep(1)
                     break
                 except TimeoutException:
                     pass
                 try:
                     dr.find_element_by_name("双人竞技")
                     time.sleep(1)
                     break
                 except NoSuchElementException:
                     pass
                 try:
                     dr.find_element_by_id(
                         "com.paoword.www.paoword:id/positive").click()
                     time.sleep(1)
                     break
                 except NoSuchElementException:
                     pass
             time.sleep(1)
         dr.press_keycode(4)
         time.sleep(1)
         self.ismenu2 = False
     except Exception as e:
         print("error in menu2")
         return self.exception_returnapp()
     return self.do
コード例 #30
0
ファイル: machineMiaopai.py プロジェクト: cash2one/brush-1
 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, 2)):
             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(15, 20))
             #关注
             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(15, 20))
             #赞
             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(15, 20))
             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