前提:
在xcode中打开模拟器,并安装上 待测APP;
操作:
step1.打开appium图形界面
step2.appium 设置如下步骤(一定要按照官方步骤一步步配置):
- Start Appium GUI app
- Open Developer Settings of Appium GUI app
- Put a tick in Enabled
- Put a tick in Custom Server Flags
- In the text field of Custom Server Logs put --native-instruments-lib
- Open General Settings and make sure Server Address is 0.0.0.0 and Port is 4725
- Open iOS Settings
- In iOS Settings, Basic tab
- Add App Path, mine is /Users/temp_user/Downloads/UICatalog.app (yes, this is the popular tutorial app) (查看下面的帮助部分,找到被测APP正确的路径)
- 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
- In iOS Settings, Advanced tab
- Put a tick in Use Native Instruments Library
- Put a tick in Instruments Launch Timeout, add 900,000 ms
- Press Launch btn in Appium GUI app ---点击 launch 按钮后,变成 stop 按扭;
- 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" ;
时间: 2024-10-24 10:30:47