appium二: 参数配置与初识inspector

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了appium二: 参数配置与初识inspector相关的知识,希望对你有一定的参考价值。

前提:

在xcode中打开模拟器,并安装上 待测APP;

操作:

step1.打开appium图形界面

step2.appium 设置如下步骤(一定要按照官方步骤一步步配置):

技术分享

  1. Start Appium GUI app

  2. Open Developer Settings of Appium GUI app

  3. Put a tick in Enabled

  4. Put a tick in Custom Server Flags

  5. In the text field of Custom Server Logs put --native-instruments-lib

  6. Open General Settings and make sure Server Address is 0.0.0.0 and Port is 4725

  7. Open ios Settings

  8. In iOS Settings, Basic tab

  9. Add App Path, mine is /Users/temp_user/Downloads/UICatalog.app (yes, this is the popular tutorial app)   (查看下面的帮助部分,找到被测APP正确的路径)

  10. Force Device, mine is iPhone 5, Platform 9.2, if you still get errors, in the appium log available devices are listed, find them and select to force device with data from the list or find device from xcode simulators list

  11. In iOS Settings, Advanced tab

  12. Put a tick in Use Native Instruments Library

  13. Put a tick in Instruments Launch Timeout, add 900,000 ms

  14. Press Launch btn in Appium GUI app  ---点击 launch 按钮后,变成 stop 按扭;

  15. Press Inspector btn in Appium GUI app ---上图中的放大镜图标,点击后 自动拉起 模拟器中的待测应用,同时出现如下画面供定位元素用;

按照上面步骤,配置完成后,可打开inspector 界面,这是进行appium 测试的第一步!

技术分享

通过inspector,可以查看 不同页面上的元素分布,并进行 元素定位与查找。。


附小帮助:

1. 模拟器的目录在这里:

/Users/你当前登陆的用户名/Library/Application Support/iPhone Simulator/

你的App被XCode Build在这里:

/Users/你当前登陆的用户名/Library/Developer/Xcode/DerivedData/YOURPROJECTNAME_SOMETHINGSOMETHING/Build/Products

2. mac 下显示所有文件目录的方式 (隐藏文件夹)

 在Terminal中复制或输入以下命令(区分大小写):

 “defaults write com.apple.Finder AppleShowAllFiles YES”

  设置完成后,重启下Finder即可生效;

3. 在Finder中快速定位某个路径 ,请按下 "command+ shift+ G" ;


以上是关于appium二: 参数配置与初识inspector的主要内容,如果未能解决你的问题,请参考以下文章

appium 1.6 使用与APP-inspector定位

appium的inspectot使用

Mac环境下使用Appium Inspector进行元素定位

Appium 桌面未在 MAC 中启动 Appium Inspector UI

Appium自动化 - 控件定位工具之Appium 的 Inspector

Appium '连接服务器失败。请使用 Inspector 检查它是不是正在运行