手机app自动化-Python-appium
博客视频地址:https://www.bilibili.com/video/BV1HY41187T1/?vd_source=c670d1787bb249e7d6c91c05c3ad58a5
笔记:https://www.yuque.com/imhelloworld/xhit9t/pt5l3x
文本开头:查找 -
input = driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR, 'new UiSelector().textStartsWith("下一步").description("下一步").index(1)').click()
我电脑设置ANDROID_HOME这个环境变量得全部大写才能启动
4、 自动化启动app
安装appium-client 的命令:pip install Appium-Python-Client 如果不行。就换一个命令:pip install Appium-Python-Client -i https://pypi.tuna.tsinghua.edu.cn/simple
from appium import webdriver
import os
apk_file = os.path.join(os.path.dirname(__file__), 'apps/app-release.apk')
desired_caps = {
'platformName': 'Android',
'platformVersion': '9',
'automationName': 'UiAutomator2',
'deviceName': '127.0.0.1:62001',
'app': apk_file
}
webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
9、免安装app启动
from appium import webdriver
import os
apk_file = os.path.join(os.path.dirname(__file__), 'apps/d080d4be887c3e6cc28ed7aa8dbcc9c2.apk')
desired_caps = {
'platformName': 'Android',
'platformVersion': '9',
'automationName': 'UiAutomator2',
'deviceName': '127.0.0.1:62001',
'noReset': True,
"fullReset": False,
"appActivity": ".index.v2.IndexActivityV2",
"appPackage": "com.xingin.xhs"
}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
driver.implicitly_wait(10)

浙公网安备 33010602011771号