def profile():
    driver = setting.case('Android', '8.0.0', 'GWY0216B26002053', 'com.wodi.who', '.login.SplashActivity')
    try:
        driver.find_element_by_id('com.wodi.who:id/phone_login').click()
        sleep(3)
        driver.find_element_by_id('com.wodi.who:id/username_login').click()
        sleep(3)
        driver.find_element_by_id('com.wodi.who:id/input_username').send_keys('10300')
        sleep(3)
        driver.find_element_by_id('com.wodi.who:id/input_password').send_keys('10300')
        sleep(3)
        driver.find_element_by_id('com.wodi.who:id/complete').click()
        if (driver.find_element_by_id('com.wodi.who:id/complete')):
            print("2")
        else:
            print('1')
    except Exception as e:
        print(e)
        shootFile = '/Users/wanba/Desktop/screeShoot'
        now = time.strftime('%Y-%m-%d-%H_%M_%S', time.localtime(time.time()))
        shootScreemFile = shootFile + '/' + '失败' + now + '_' + 'profile.png'
        driver.get_screenshot_as_file(shootScreemFile)
        driver.quit()
        return False
    return True
Example #2
0
def shop():
    driver = setting.case('Android', '8.0.0', 'GWY0216B26002053',
                          'com.wodi.who', '.login.SplashActivity', '10300',
                          '10300')
    try:
        # 点击钻石进入商城
        driver.find_element_by_id('com.wodi.who:id/tv_diamond').click()
        driver.keyevent(4)
        # 点击金币进入商城
        driver.find_element_by_id('com.wodi.who:id/tv_coin').click()
        driver.keyevent(4)
        # 进入商城购买钻石
        driver.find_element_by_id('com.wodi.who:id/tv_coin').click()
        driver.find_element_by_android_uiautomator("text(\"购买钻石\")").click()
        driver.find_element_by_android_uiautomator("text(\"¥6\")").click()
        driver.keyevent(4)
        driver.find_element_by_android_uiautomator("text(\"¥18\")").click()
        driver.keyevent(4)
        driver.find_element_by_android_uiautomator("text(\"¥88\")").click()
        driver.keyevent(4)
        # 跳转喊话页
        driver.find_element_by_android_uiautomator("text(\"¥388\")").click()
        sleep(1)
        driver.find_element_by_id('com.wodi.who:id/message').send_keys(
            'Hell0,World')
        driver.find_element_by_android_uiautomator("text(\"确认购买\")").click()
        driver.keyevent(4)
        driver.find_element_by_android_uiautomator("text(\"¥388\")").click()
        driver.find_element_by_android_uiautomator("text(\"取消\")").click()
        driver.find_element_by_id('com.wodi.who:id/button_accept').click()
        driver.find_element_by_android_uiautomator("text(\"兑换\")").click()
        driver.find_element_by_android_uiautomator("text(\"400\")").click()
        driver.find_element_by_id('com.wodi.who:id/cancel_excahnge').click()
        driver.find_element_by_android_uiautomator("text(\"400\")").click()
        driver.find_element_by_id('com.wodi.who:id/sure_excahnge').click()
        driver.keyevent(4)
        driver.find_element_by_id('com.wodi.who:id/tv_coin').click()
        driver.find_element_by_id(
            'com.wodi.who:id/backpack_layout_icon').click()
        driver.keyevent(4)
        driver.keyevent(4)
        driver.quit()
    except Exception as e:
        print(e)
        shootFile = '/Users/wanba/Desktop/screeShoot'
        now = time.strftime('%Y-%m-%d-%H_%M_%S', time.localtime(time.time()))
        shootScreemFile = shootFile + '/' + '失败' + now + '_' + 'shop.png'
        driver.get_screenshot_as_file(shootScreemFile)
        return False
    return True
def profile():
    driver = setting.case('Android', '8.0.0', 'GWY0216B26002053',
                          'com.wodi.who', '.login.SplashActivity', '10300',
                          '10300')
    try:
        # 点击首页个人头像
        driver.find_element_by_id('com.wodi.who:id/iv_user_icon').click()
        # 点击profile页 编辑按钮
        driver.find_element_by_id('com.wodi.who:id/setting_btn').click()
        # 返回
        driver.keyevent(4)
        # 进入守护profile页
        driver.find_element_by_id('com.wodi.who:id/protect_avatar').click()
        driver.keyevent(4)
        # 进入后宫(由于后宫是通过android fragment布局,目前一些元素无法获取,暂无法操作 )
        # driver.find_element_by_id('com.wodi.who:id/tv_slave_count').click()
        # driver.keyevent(4)
        # 进入相册
        driver.find_element_by_id('com.wodi.who:id/album').click()
        driver.keyevent(4)
        x = driver.get_window_size()['width']
        y = driver.get_window_size()['height']
        sleep(1)
        driver.swipe(x / 2, y * 8 / 10, x / 2, y * 3 / 10, 200)
        # 进入徽章
        driver.find_element_by_id('com.wodi.who:id/honors_layout').click()
        driver.keyevent(4)
        # 进入礼物
        driver.find_element_by_id('com.wodi.who:id/gift_layout').click()
        driver.find_element_by_android_uiautomator("text(\"收到礼物\")").click()
        driver.find_element_by_android_uiautomator("text(\"月贡献榜\")").click()
        driver.keyevent(4)
        driver.quit()
    except Exception as e:
        print(e)
        shootFile = '/Users/wanba/Desktop/screeShoot'
        now = time.strftime('%Y-%m-%d-%H_%M_%S', time.localtime(time.time()))
        shootScreemFile = shootFile + '/' + '失败' + now + '_' + 'profile.png'
        driver.get_screenshot_as_file(shootScreemFile)
        driver.quit()
        print('profile 失败')
        return False
    print('profile 成功')
    return True
Example #4
0
def profile():
    driver = setting.case('Android', '8.0.0', 'GWY0216B26002053', 'com.wodi.who', '.login.SplashActivity','10300','10300')
    try:
        x = driver.get_window_size()['width']
        y = driver.get_window_size()['height']
        i = 1
        print("1")
        sleep(3)
        while i < 10000:
            sleep(0.5)
            driver.swipe(x / 2, y * 8 / 10, x / 2, y * 3 / 10, 200)
            sleep(0.5)
            driver.swipe(x / 2, y * 8 / 10, x / 2, y * 3 / 10, 200)
            sleep(0.5)
            driver.swipe(x / 2, y * 8 / 10, x / 2, y * 3 / 10, 200)
            sleep(0.5)
            driver.swipe(x / 2, y * 3 / 10, x / 2, y * 8 / 10, 200)
            sleep(0.5)
            driver.swipe(x / 2, y * 3 / 10, x / 2, y * 8 / 10, 200)
            sleep(0.5)
            driver.swipe(x / 2, y * 3 / 10, x / 2, y * 8 / 10, 200)
            # driver.swipe(x / 2, y * 8 / 10, x / 2, y * 7 / 10, 500)
            # driver.swipe(x / 2, y * 8 / 10, x / 2, y * 7 / 10, 500)
            # driver.swipe(x / 2, y * 8 / 10, x / 2, y * 7 / 10, 500)
            # driver.swipe(x / 2, y * 7 / 10, x / 2, y * 8 / 10, 500)
            # driver.swipe(x / 2, y * 7 / 10, x / 2, y * 8 / 10, 500)
            # driver.swipe(x / 2, y * 7 / 10, x / 2, y * 8 / 10, 500)
            # driver.swipe(x / 2, y * 3 / 10, x / 2, y * 8 / 10, 500)
            i += 1
            print(i)
    except Exception as e:
        print(e)
        shootFile = '/Users/wanba/Desktop/screeShoot'
        now = time.strftime('%Y-%m-%d-%H_%M_%S', time.localtime(time.time()))
        shootScreemFile = shootFile + '/' + '失败' + now + '_' + 'profile.png'
        driver.get_screenshot_as_file(shootScreemFile)
        driver.quit()
        print('profile 失败')
        return False
    print('profile 成功')
    return True
Example #5
0
def icon():
    driver = setting.case('Android', '8.0.0', 'GWY0216B26002053',
                          'com.wodi.who', '.login.SplashActivity', '10300',
                          '10300')
    try:
        driver.find_element_by_android_uiautomator("text(\"福利社\")").click()
        driver.find_element_by_id('com.wodi.who:id/tv_honner').click()
        driver.keyevent(4)
        driver.keyevent(4)
        driver.find_element_by_android_uiautomator("text(\"福利社\")").click()
        driver.find_element_by_android_uiautomator("text(\"成长任务\")").click()
        driver.find_element_by_android_uiautomator("text(\"日常任务\")").click()
        driver.keyevent(4)
        # driver.find_element_by_android_uiautomator("text(\"后宫\")").click()
        # sleep(3)
        # driver.find_element_by_id('com.wodi.who:id/slave_not_intrinsting').click()
        # driver.find_element_by_android_uiautomator("text(\"后宫秘籍\")").click()
        driver.find_element_by_android_uiautomator("text(\"熟人房\")").click()
        driver.find_element_by_id('com.wodi.who:id/wb_right_action').click()
        driver.keyevent(4)
        driver.find_element_by_id('com.wodi.who:id/create_room_bg_iv').click()
        driver.keyevent(4)
        driver.find_element_by_id('com.wodi.who:id/search_room_bg_iv').click()
        driver.keyevent(4)
        driver.keyevent(4)
        driver.find_element_by_android_uiautomator("text(\"好友在玩\")").click()
        driver.keyevent(4)
        driver.quit()
    except Exception as e:
        print(e)
        shootFile = '/Users/wanba/Desktop/screeShoot'
        now = time.strftime('%Y-%m-%d-%H_%M_%S', time.localtime(time.time()))
        shootScreemFile = shootFile + '/' + '失败' + now + '_' + 'icon.png'
        driver.get_screenshot_as_file(shootScreemFile)
        driver.quit()
        return False
    return True
Example #6
0
def profile():
    driver = setting.case('Android', '8.0.0', 'GWY0216B26002053',
                          'com.wodi.who', '.login.SplashActivity')
    try:
        driver.find_element_by_id('com.wodi.who:id/phone_login').click()
        sleep(3)
        driver.find_element_by_id('com.wodi.who:id/username_login').click()
        sleep(3)
        driver.find_element_byla_id(
            'com.wodi.who:id/input_username').send_keys('10300')
        sleep(3)
        driver.find_element_by_id('com.wodi.who:id/input_password').send_keys(
            '10300')
        sleep(3)
        driver.find_element_by_id('com.wodi.who:id/complete').click()
        sleep(3)
        x = driver.get_window_size()['width']
        y = driver.get_window_size()['height']
        driver.swipe(x / 2, y * 7 / 8, x / 2, y * 1 / 8, 500)
        sleep(3)
        driver.find_element_by_id('com.wodi.who:id/more_button').click()
        sleep(3)
        driver.keyevent(4)
        sleep(3)
        driver.find_element_by_android_uiautomator("text(\"找你妹\")").click()
        sleep(3)
        driver.keyevent(4)
        sleep(3)
        driver.find_element_by_android_uiautomator("text(\"五子棋\")").click()
        sleep(3)
        driver.keyevent(4)
        sleep(3)
        driver.find_element_by_android_uiautomator("text(\"玩吧天梯赛\")").click()
        sleep(3)
        driver.keyevent(4)
        sleep(3)
        sleep(3)
        driver.find_element_by_android_uiautomator("text(\"更多小游戏\")").click()
        sleep(3)
        driver.keyevent(4)
        sleep(3)
        # print('1')
        # driver.find_elements_by_class_name('android.widget.FrameLayout')
        # print('2')
        # sleep(5)
        # print(gameGroup)
        # for xiaoGame in gameGroup:
        #     xiaoGame.click()
        #     sleep(3)
        #     driver.keyevent(4)
        #     sleep(3)
        # driver.keyevent(4)
        driver.quit()
    except Exception as e:
        print(e)
        shootFile = '/Users/wanba/Desktop/screeShoot'
        now = time.strftime('%Y-%m-%d-%H_%M_%S', time.localtime(time.time()))
        shootScreemFile = shootFile + '/' + '失败' + now + '_' + 'profile.png'
        driver.get_screenshot_as_file(shootScreemFile)
        driver.quit()
        return False
    return True