本文最后更新于 2025-01-09T16:04:33+08:00
appium以及appium-inspector安装及配置
appium需要使用比较新的版本的nodejs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| sudo apt update curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install -y nodejs node -v npm -v
sudo apt install openjdk-17-jdk
wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip sudo unzip commandlinetools-linux-6858069_latest.zip
sudo ln -s /path/to/sdkmanager /bin/sdkmanager sudo sdkmanager --proxy=http --proxy_host=host --proxy_port=port --sdk_root=/opt/android-sdk "platforms;android-28"" sudo sdkmanager --proxy=http --proxy_host=host --proxy_port=port --sdk_root=/opt/android-sdk "platform-tools"
sudo ln -s /path/to/adb /bin/adb sudo npm config set proxy http://your-proxy-server:port sudo npm install -g appium appium driver install uiautomator2
|
子网内通过adb连接到手机,
获取包名:
1
| adb shell pm list packages | grep xxx
|
获取启动activity:
1
| adb shell monkey -p com.package.name -c android.intent.category.LAUNCHER -v -v 0 | grep Using
|
appium服务器中运行appium
启动服务,然后配置appium-inspector:
1 2 3 4 5 6 7 8
| { "platformName": "Android", "appium:platformVersion": "9.0", "appium:deviceName": "device-serial", "appium:appPackage": "com.package.name", "appium:appActivity": "com.package.name.Activity", "appium:automationName": "UiAutomator2" }
|
ADB常用命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| adb devices
adb connect 192.168.1.111:5555
adb -s serial-0001 shell ls
adb shell pm list packages | grep xxx adb shell pm list packages | findstr xxx
adb shell /system/bin/screencap -p /sdcard/ss.png adb pull /sdcard/ss.png .
|
References
appium inspector配置
http://zr4in.github.io/2025/01/03/appium-inspector配置/