1、下载安装Android studio
下载链接:https://developer.android.google.cn/studio/
安装方法连接:https://blog.csdn.net/qq_41976613/article/details/91432304
2、配置andriod 环境变量
验证方法:cmd命令窗口输入“adb"
3、下载安装appium desktop
下载地址:https://github.com/appium/appium-desktop
安装方法:cmd 命令窗口输入”pip install Appium-Python-Client"
4、尝试监听Adriod 模拟器
方法:1、启动Adriod模拟器
2、cmd窗口输入“adb devices"
appium:
查看platformVersion: adb shell getprop ro.build.version.release
查看deviceName: adb devices -l
先运行应用,然后查看appPackage以及appActivity: adb shell dumpsys activity| findstr "mResume"
# This sample code uses the Appium python client # pip install Appium-Python-Client # Then you can paste this into a file and simply run with Python from appium import webdriver from appium.webdriver.common.touch_action import TouchAction from time import sleep caps = {} caps["platformName"] = "Android" caps["platformVersion"] = "11" caps["deviceName"] = "emulator-5554" caps["automationName"] = "appium" caps["ensureWebviewsHavePages"] = True driver = webdriver.Remote("http://localhost:4723/wd/hub", caps) TouchAction(driver).tap(x=128, y=1474).perform() TouchAction(driver).tap(x=598, y=1093).perform() sleep(2) driver.quit()
运行代码前:
运行代码后: