JDK:
Node.js:
SDK:
1、下载:https://www.androiddevtools.cn/
2、解压到非中文名目录下,安装
只勾选这三个:
安装后目录结构
3、配置环境变量:
添加path:
appium v1升级为appium v2:
卸载原有版本,重新安装新版本
并下载driver :uiautomator2(用于安卓)和xcuitest(用于ios):
查看安装driver:
appium inspector:
1、https://github.com/appium/appium-inspector/releases
下载对应版本:
直接安装:
2、连接真机:
手机打开开发者模式
appium client:
1、python中安装
pip install Appium-Python-Client
2、
import unittest
from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy
capabilities = dict(
platformName='Android',
automationName='uiautomator2',
deviceName='Android',
appPackage='com.android.settings',
appActivity='.Settings',
language='en',
locale='US'
)
appium_server_url = 'http://localhost:4723'
class TestAppium(unittest.TestCase):
def setUp(self) -> None:
self.driver = webdriver.Remote(appium_server_url, options=UiAutomator2Options().load_capabilities(capabilities))
def tearDown(self) -> None:
if self.driver:
self.driver.quit()
def test_find_battery(self) -> None:
el = self.driver.find_element(by=AppiumBy.XPATH, value='//*[@text="Battery"]')
el.click()
if __name__ == '__main__':
unittest.main()
3、启动服务:
4、执行脚本: