启动多个appium服务(同时运行多台设备)
1.启动appium服务,可以用命令行模式
第一个appium服务,可以指定一个端口 -p 4723,然后指定一个设备名称 -u 【真机】,也就是-U参数(adb devices可以查看),-bp是指定bootstrap-port
(多个appium启动链接多个android设备时需要设置不同的 bootstrap-port )
appium -a 127.0.0.1 -p 4723 -bp 4726 -U ML5RRPCUWO
第二个appium 服务指定设备名称【夜神模拟器】
appium -a 127.0.0.1 -p 4724 -bp 4725 -U 127.0.0.1:62001
frida 运行
frida安装
1 、安装python3.8并配置好环境变量(官方推荐python3以上版本至少为3.7),python安装包官方下载地址:https://www.python.org/downloads/。
2 、安装frida模块,命令为pip install frida
(配置了多个python版本环境的可以使用命令python -m pip install frida
防止用pip install frida
命令报错)。
3、安装frida-tools模块,命令同上,pip install frida-tools
或者python -m pip install frida-tools
。
运行
frida frida-ps -U
PID Name
----- ------------
19990 frida-server
19778 sh
adb shell
cd /data/local/tmp
# Unable to load SELinux policy from the kernel: Failed to open file ?/sys/fs/selinux/policy?: Permission denie
# 需要切换到root,否则不能hook
su root
./frida-server & # 必须运行
# computer 设置端口转发
adb forward tcp:27042 tcp:27042
adb forward tcp:27043 tcp:27043
# 查看对应的app列表,如果显示对应的包表示frida顺利开启
frida-ps -U
# 打开app
# 运行脚本等
appium 不能启动问题
An unknown server-side error occurred while processing the command. Original error: The instrumentation process cannot be initialized. Make sure the application under test does not crash and investigate the logcat output.
image.png在添加参数的时候加上参数 automationName=UiAutomator1,解决问题。
adb查看app启动页Activity
setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb shell "dumpsys window | grep mCurrentFocus"
# 显示对应的启动页的APP
mCurrentFocus=Window{b6eb3a8 u0 com.smile.gifmaker/com.yxcorp.gifshow.HomeActivity}
adb devices offline
adb 在连接多次之后会出现设备的脱机情况。原因未知。
此时需要执行以下命令。
adb kill-server
adb star-server
adb remount
安装appium
npm config set registry “https://registry.npm.taobao.org/”
// 查看配置项
npm config list
安装appium
npm install -g appium
npm install -g appium-doctor
安装pm2
npm install -g pm2
启动appium服务
appium-doctor 检查环境
echo "export ANDROID_HOME=/opt/androidSdk" >> /etc/profile
echo "export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools" >> /etc/profile
info AppiumDoctor Appium Doctor v.1.16.0
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor ✔ Node version is 16.1.0
WARN AppiumDoctor ✖ ANDROID_HOME environment variable is NOT set!
info AppiumDoctor ✔ JAVA_HOME is set to: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64
WARN AppiumDoctor ✖ adb, android, emulator could not be found because ANDROID_HOME or ANDROID_SDK_ROOT is NOT set!
info AppiumDoctor ✔ 'bin' subfolder exists under '/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64'
info AppiumDoctor ### Diagnostic for necessary dependencies completed, 2 fixes needed. ###
info AppiumDoctor
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
WARN AppiumDoctor ✖ opencv4nodejs cannot be found.
WARN AppiumDoctor ✖ ffmpeg cannot be found
WARN AppiumDoctor ✖ mjpeg-consumer cannot be found.
WARN AppiumDoctor ✖ bundletool.jar cannot be found
info AppiumDoctor ✔ gst-launch-1.0 and gst-inspect-1.0 are installed at: /usr/bin/gst-launch-1.0 and /usr/bin/gst-inspect-1.0
info AppiumDoctor ### Diagnostic for optional dependencies completed, 4 fixes possible. ###
info AppiumDoctor
info AppiumDoctor ### Manual Fixes Needed ###
info AppiumDoctor The configuration cannot be automatically fixed, please do the following first:
WARN AppiumDoctor ➜ Make sure the environment variable ANDROID_HOME is properly configured for the Appium process. Refer https://github.com/appium/java-client/blob/master/docs/environment.md for more details.
WARN AppiumDoctor ➜ Manually configure ANDROID_HOME and run appium-doctor again.
info AppiumDoctor
info AppiumDoctor ### Optional Manual Fixes ###
info AppiumDoctor The configuration can install optionally. Please do the following manually:
WARN AppiumDoctor ➜ Why opencv4nodejs is needed and how to install it: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
WARN AppiumDoctor ➜ ffmpeg is needed to record screen features. Please read https://www.ffmpeg.org/ to install it
WARN AppiumDoctor ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP features. Please install it with 'npm i -g mjpeg-consumer'.
WARN AppiumDoctor ➜ bundletool.jar is used to handle Android App Bundle. Please read http://appium.io/docs/en/writing-running-appium/android/android-appbundle/ to install it
info AppiumDoctor
info AppiumDoctor ###
info AppiumDoctor
info AppiumDoctor Bye! Run appium-doctor again when all manual fixes have been applied!
info AppiumDoctor
/usr/local/douyin/appium/node_modules/.bin 在这里启动appium
访问4723端口会出现“The URL ‘/’ did not map to a valid resource”,则启动成功。
网友评论