Appium跳过app登录

有的app登录过程很麻烦,所以自动化测试可以跳过登录过程,避免掉麻烦

首先想跳过,前面启动的代码就不能锁定包

from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.common.by import By
    appium_server_url = 'http://127.0.0.1:4723'    #appium 2.0

    capabilities ={
        "platformName": "Android",
        "appium:deviceName": "device",
        "appium:automationName": "uiautomator2"
    }

然后,获取能点击到app 的element,点击

    driver = webdriver.Remote(appium_server_url, options=UiAutomator2Options().load_capabilities(capabilities))
    wait = WebDriverWait(driver, 60, 0.5)
    el3 = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value="appele")
    el3.click()
    time.sleep(100)

 

posted @ 2025-12-23 10:53  金一九  阅读(9)  评论(0)    收藏  举报