Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

Common Issues

shengxiang edited this page Nov 15, 2016 · 9 revisions

iOS Common Issues

Mainly about the WebDriverAgent

The bundle “WebDriverAgentRunner” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.

run完./Scripts/bootstrap.sh把需要的库都down下来了,但是WebDriverAgent.xcodeproj并没自动添加, 需要手动添加. 将WebDriverAgentLib.frameworkKissXML.frameworkRoutingHTTPSever.frameworkWebDriverAgent.framework这四个库到WebDriverAgentRunner这个Scheme里面就可以了

How to keep iPhone screen on ?

  1. 通用/自动锁定 改成永不
  2. 显示与亮度 调到最低

How to know my udid

http://whatsmyudid.com/

其他90%的问题

  1. 重启iPhone
  2. 重启Mac
  3. 更新XCode

ideviceinstaller is not working with iOS 10.0 version(Could not connect to lockdownd. Exiting.)

  1. Firstly, you can try "sudo chmod -R 777 /var/db/lockdown/". If it does not work, please try step 2
  2. Reinstall ideviceinstaller and libimobiledevice, as the following:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install ideviceinstaller
brew link --overwrite ideviceinstaller

Android Common Issues

uiautomator.JsonRPCError: JsonRPC Error code: 0, Message: java.lang.IllegalStateException: UiAutomation not connected!

还没有复线过

如果连接远程机器上的安卓设备

远程机器上使用如下命令启动命令

adb kill-server
adb -P 5037 -a nodaemon server
# or: adb -P 5037 -a fork-server server

连接时指定远程机器的IP和端口号就好了

如何一个脚本可以适应不同的机器(针对于手机游戏)

市面上大部分的手机都是 16:9 还有一部分是 4:3,5:3,8:5 其他比例的似乎寥寥。而游戏中元素的大小,在屏幕变化的时候,也会等比例的去缩放。16:9到4:3的缩放比例似乎也有规律可循,暂时不研究啦。

W/H Display
16/9 540x960, 720x1280, 1080x1920, 1440x2560
8/5 800x1280, 1200x1920, 1600x2560
5/3 1152x1920, 1080x1800
4/3 1536x2048

所以通常只需要找个分辨率高点的设备,然后截个图。同样宽高比的手机就可以一次拿下。

d.resolution = (1080, 1920)

设置完后,当遇到其他分辨率的手机,就会自动去缩放。因为ATX主要针对游戏用户,横屏的时候,缩放是根据Y轴缩放的,竖排则根据X轴。可能有点抽象,理解不了也没关系

是否可以在模拟器上运行自动测试

测试后,发现是可以的。我直接用了当前市场上最流行的海马玩 版本0.9.0 Beta 安装完之后使用 adb connect 127.0.0.1:26944 连接上,之后的操作就跟普通的手机一样了。注: 根据海马玩版本的不同,端口可能也不一定一样

海马玩监听的端口是本机的26944,如果需要测试脚本运行在远程,用tcp转发到0.0.0.0就好了。方法有很多,可以用自带的程序 python -matx tcpproxy 或者直接参考目录下的 scripts/simple-tcp-proxy.py 用代码实现

很多模拟器的引擎是VirutualBox,其实还可以通过VirtualBox的接口来截图,这种方法更快一点,不过看说明安装似乎很复杂,试验了下也没成功,若是有人搞定了,可以分享下

  • iTools模拟器: adb connect 127.0.0.1:54001
  • 海马玩:adb connect 127.0.0.1:26944

minicap是什么, 如何安装?

minicap是openstf开源项目中的一个子项目,用于手机快速的截图. 连接手机到电脑上之后,简单的安装方法 python -matx minicap 注意:请不要在模拟器上尝试

测试安卓应用遇到 IOError: RPC server not started!

卸载已有的应用,重新运行测试

adb uninstall com.github.uiautomator
adb uninstall com.github.uiautomator.test

How to uninstall android test stuff?

adb uninstall com.github.uiautomator
adb uninstall com.github.uiautomator.test

adb shell rm /data/local/tmp/minicap
adb shell rm /data/local/tmp/minicap.so

解决输入法遇到的问题

首先安装ATX助手,该App包含了一个专门为自动化开发的Utf7Ime的输入法,该输入法的实现参考了android-unicode

python -m atx install atx-assistant
adb shell ime enable com.netease.atx.assistant/.ime.Utf7ImeService
adb shell ime set com.netease.atx.assistant/.ime.Utf7ImeService

输入法关闭方法

adb shell ime disable com.netease.atx.assistant/.ime.Utf7ImeService

部分模拟器可能并不支持,需要使用模拟器特定的API,或者使用 adb shell input text some-text

测试小米手机提示 java.lang.SecurityException: Injecting to another application

java.lang.SecurityException: Injecting to another application
requires INJECT_EVENTS permission

解决办法:

进入开发者选项,开启选择 USB调试(安全设置) 该选项的描述信息为 允许通过USB调试修改权限或模拟点击