MAC自动化环境搭建
UI自动化环境搭建
第一阶段:配置appium环境
硬件配置
mac系统电脑
java环境
sunjiedeMacBook-Air:~ vicent$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
brew
sunjiedeMacBook-Air:~ vicent$ brew -v
Homebrew 1.2.3
Homebrew/homebrew-core (git revision aa923; last commit 2017-06-23)
安装node:brew install node
安装appium:npm install –g appium
安装xcode、android sdk
创建bash_profile文件
touch .bash_profile
vi .bash_profile
打开bash_profile文件配置ANDROID_HOME和JAVA_HOME
export ANDROID_HOME="/Users/guowenxie/Documents/adt-bundle-mac-x86_64-20140702/sdk" 填写你自己的地址
export JAVA_HOME=$(/usr/libexec/java_home)
source .bash_profile
第二阶段:获取控件定位
1、安装app-inspector
a)先安装macaca
卸载原有的macaca:
1、npm uninstall macaca-cli -g
2、npm cache clean
安装:npm install macaca-cli -g
安装完成后,检查环境是否正常,终端输入:macaca doctor
只要全部显示为绿色为环境正常,若不正常,哪项显示为红色相应的解决,可以网上找一下资料,还是挺全的
b)安装brew:ruby -e "$(curl –fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
c)安装ios-webkit-debug-proxy:brew install ios-webkit-debug-proxy
d)安装macaca-ios:npm i macaca-ios -g
e) Macaca iOS 驱动调整为 USB 通信:brew install usbmuxd
f)安装app-inspector
卸载原有的app-inspector:
1、npm uninstall app-inspector -g
2、npm cache clean
安装:npm i app-inspector -g
安装成功后在终端中输入:
>>>cd /usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent
>>>mkdir -p Resources/WebDriverAgent.bundle
>>>sh ./Scripts/bootstrap.sh -d
若在执行以上3句命令行报错说找不到某些目录时的解决办法:
前往:https://github.com/facebook/WebDriverAgent 打包下载源码;
复制源码中【WebDriverAgentTests文件夹】、【Scripts文件夹】、【Cartfile文件】、【Cartfile.resolved文件】
粘贴到/usr/local/lib/node_modules/app-inspector/node_modules/webdriveragent/WebDriverAgent 目录下
重新执行以上3句命令行
g)安装ios-deploy:brew install ios-deploy
2、:xcode打开app-inspector中的WebDriverAgent工程:
路径为:/usr/local/lib/node_modules/app-inspector/node_modules/.1.0.41@webdriveragent/WebDriverAgent/WebDriverAgent.xcodeproj
1) 重新编绎WebDriverAgentLib:
修改:Bundle id,添加Team,选择WebDriverAgentLib并编辑(如下面3张图)
2)如以上步骤重新编绎WebDriverAgentRunner
3)选择WebDriverAgentUSBClient并编绎
4)按照步骤1)中修改:Bundle id,添加Team,重新编绎IntegrationApp,但是需要添加一步修改Product Name为: WebDriverAgentRunner-Runner
此时选中IntegrationApp并编绎时,可能会报错:找不到info.plist (这个是因为工程中缺少一个目录文件:WebDriverAgentTests)
解决办法:进入appium的安装路径中WebDriverAgent工程(/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/)中拷备该目录文件放到app-inspectorWebDriverAgent工程中
再次编绎,若报错新问题: Main storyboard file base name 相关的问题的问题
解决办法:进入IntegrationApp>info>Custom iOS Target Properties中删除Main storyboard file base name的配置
若遇到其它问题,继续解决,直到可以正确编绎为止
建议:UnitTests、IntegrationTests 也如1)修改:Bundle id,添加Team,操作后最后再编绎 IntegrationApp
3、打开终端,输入 :macaca server --verbose
出现以下内容
sunjiedeMacBook-Air:~ vicent$ macaca server --verbose
************************************
* version 2.0.3 is outdate *
* run: npm i -g macaca-cli@2.0.4 *
************************************
More information: https://macacajs.github.io/changelog.html
>> index.js:18:12 [master] pid:3450 webdriver server start with config:
{ port: 3456,
verbose: true,
always: true,
ip: '10.11.18.157',
host: 'sunjiedeMacBook-Air.local',
loaded_time: '2017-06-26 13:51:12' }
>> middlewares.js:17:10 [master] pid:3450 base middlewares attached
>> router.js:127:10 [master] pid:3450 router set
>> webdriver sdk launched
4、打开终端,输入:app-inspector -u 真机设备UDID --verbose
运行过程中会在手机上安装WebDriverAgent的APP(记得要去信任证书才行,若第一次失败了,信任证书后重新执行终端命令)并启动,稍等一会儿会被置入后台,此时会自动打开一个网页,此时就会显示出当前的设备UI界面
sunjiedeMacBook-Air:~ vicent$ app-inspector -u 95fe7916c490ffc58b7c3ff95e2642009ab0f1ef --verbose
***************************************
* version 2.0.3 is outdate *
* run: npm i -g app-inspector@2.0.6 *
***************************************
>> server.js:16:12 [master] pid:3493 server start with config:
{ port: 5678,
verbose: true,
udid: '95fe7916c490ffc58b7c3ff95e2642009ab0f1ef',
ip: '10.11.18.157',
host: 'sunjiedeMacBook-Air.local',
loaded_time: '2017-06-26 13:53:12' }
>> app-inspector.js:43:12 [master] pid:3493 server start at: http://10.11.18.157:5678
>> xctest-client.js:52:14 [master] pid:3493 project path: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
>> xctestwd start with port: 8001
>> xctest-client.js:224:14 [master] pid:3493 xcode version: 8.3.2
>> XCTestWD version: 1.0.31
>> xctest-client.js:172:14 [master] pid:3493 2017-06-26 13:53:14.414 xcodebuild[3499:285075] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
/Users/vicent/Library/Developer/Xcode/DerivedData/XCTestWD-evljajykmolwzobrozpobiggeeea/Logs/Test/E7D94522-B4BE-4053-AB67-DA5E0F1763B2/Session-XCTestWDUITests-2017-06-26_135314-wX8vjB.log
>> xctest-client.js:173:14 [master] pid:3493 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
>> xctest-client.js:172:14 [master] pid:3493 2017-06-26 13:53:14.415 xcodebuild[3499:285021] [MT] IDETestOperationsObserverDebug: (579558DA-9AA1-4CE5-9D5F-7088803FDE27) Beginning test session XCTestWDUITests-579558DA-9AA1-4CE5-9D5F-7088803FDE27 at 2017-06-26 13:53:14.414 with Xcode 8E2002 on target <DVTiOSDevice: 0x7f933a858580> {
deviceSerialNumber: C76R89ZHGRYD
identifier: 95fe7916c490ffc58b7c3ff95e2642009ab0f1ef
deviceClass: iPhone
deviceName: VincePhone
deviceIdentifier: 95fe7916c490ffc58b7c3ff95e2642009ab0f1ef
productVersion: 10.3.2
buildVersion: 14F89
deviceSoftwareVersion: 10.3.2 (14F89)
deviceArchitecture: arm64
deviceTotalCapacity: 60253212672
deviceAvailableCapacity: 22598217728
deviceIsTransient: NO
ignored: NO
deviceIsBusy: NO
deviceIsActivated: YES
deviceActivationState: Activated
isPasscodeLocked: YES
deviceType: <DVTDeviceType:0x7f933a65fb30 Xcode.DeviceType.iPhone>
supportedDeviceFamilies: (
1
)
applications: (null)
provisioningProfiles: (null)
activityProgress: -2
activityTitle:
hasInternalSupport: NO
isSupportedOS: YES
developerDiskMountError: (null)
(null)
bootArgs: <unavailable>
} (10.3.2 (14F89))
>> xctest-client.js:173:14 [master] pid:3493 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
>> xctest-client.js:172:14 [master] pid:3493 MDMCreateDeltaDirectory:1920 calling MDMDirectoryDiff with:
state->old_bundle: /var/folders/tg/nr44b54n29g821rtyr8tr3540000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/4cc79676076eb780d086ade00486f50b/95fe7916c490ffc58b7c3ff95e2642009ab0f1ef/XCTestWDUITests-Runner.app
state->new_bundle: /Users/vicent/Library/Developer/Xcode/DerivedData/XCTestWD-evljajykmolwzobrozpobiggeeea/Build/Products/Debug-iphoneos/XCTestWDUITests-Runner.app
state->dst_bundle: /var/folders/tg/nr44b54n29g821rtyr8tr3540000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/XCTestWDUITests-Runner.app.ghDWUa/XCTestWDUITests-Runner.app_sparse.ipa/Payload//XCTestWDUITests-Runner.app, binaryDiff flag: FALSE
dst_ipa: /var/folders/tg/nr44b54n29g821rtyr8tr3540000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/XCTestWDUITests-Runner.app.ghDWUa/XCTestWDUITests-Runner.app_sparse.ipa
>> xctest-client.js:173:14 [master] pid:3493 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
>> xctest-client.js:172:14 [master] pid:3493 __MDMDirectoryDiff_block_invoke.37:1473 calling writeDictToFile with: /var/folders/tg/nr44b54n29g821rtyr8tr3540000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/XCTestWDUITests-Runner.app.ghDWUa/XCTestWDUITests-Runner.app_sparse.ipa/ManifestCache.plist
>> xctest-client.js:173:14 [master] pid:3493 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
>> xctest-client.js:172:14 [master] pid:3493 writeDictToFile:1278 ==== Successfully wrote Manifest cache to /var/folders/tg/nr44b54n29g821rtyr8tr3540000gn/C/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas/XCTestWDUITests-Runner.app.ghDWUa/XCTestWDUITests-Runner.app_sparse.ipa/ManifestCache.plist
>> xctest-client.js:173:14 [master] pid:3493 please check project: /usr/local/lib/node_modules/app-inspector/node_modules/xctestwd/XCTestWD/XCTestWD.xcodeproj
错误解决:
1) xctest client proxy error with: Error: socket hang up问题:
a)安装usbmuxd:brew install usbmuxd
b)命令行执行:iproxy 8900 8100(或者是8100 8100)
c)启动app-inspecter
若遇到其它问题,继续解决,直到可以正确编绎为止
建议:UnitTests、IntegrationTests 也如1)修改:Bundle id,添加Team,操作后最后再编绎 IntegrationApp
MAC自动化环境搭建的更多相关文章
- Appium+python自动化16-appium1.6在mac上环境搭建启动ios模拟器上Safari浏览器
前言 在mac上搭建appium踩了不少坑,先是版本低了,启动后无限重启模拟器.后来全部升级最新版本,就稳稳的了. 环境准备: 1.OS版本号10.12 2.xcode版本号8.3.2 3.appiu ...
- iOS自动化环境搭建——macaca
macaca-java for ios 自动化环境搭建 基础原理解析:https://testerhome.com/topics/6608 一.环境搭建 1.安装eclipse; -----Java开 ...
- 基于python的App UI自动化环境搭建
Android端Ui 自动化环境搭建 一,安装JDK.SDK 二,添加环境变量 Widows:1.系统变量→新建 JAVA_HOME 变量E:\Java\jdk1.7.0 jdk安装目录 2.系统变量 ...
- appium ios真机自动化环境搭建&运行(送源码)
appium ios真机自动化环境搭建&运行(送源码) 原创: f i n 测试开发社区 6天前 Appium测试环境的搭建相对比较烦琐,不少初学者在此走过不少弯路 首先是熟悉Mac的使用 ...
- appium ios真机自动化环境搭建&运行(送源码)
appium ios真机自动化环境搭建&运行(送源码) 原创: f i n 测试开发社区 6天前 Appium测试环境的搭建相对比较烦琐,不少初学者在此走过不少弯路 首先是熟悉Mac的使用 ...
- 团队自动化环境搭建与管理--php博弈
我是方少,很开心与大家日后与大家交流技术上面的一些想法和一些业务上的分享.以前从来没写过博客,因为觉得不重要吧,如今觉得有必要沉淀一些想法和回忆.好了费话不多说. 先上图: 业务问题:在每次新伙伴加入 ...
- Java自动化环境搭建笔记(3)
Java自动化环境搭建笔记(3) 自动化测试 自动化的环境已经基本搭建完成,后续可对BaseTester基类以及工具类进行扩展.下面便是持续集成的环境的搭建: Jenkins安装 git安装 源码上传 ...
- Java自动化环境搭建笔记(2)
Java自动化环境搭建笔记(2) 自动化测试 在笔记一中已经完成了一键构建项目.xml指定规划测试集.数据解耦与allure报告生成的开发.接下来便是: 浏览器驱动通过配置启动 页面元素定位解耦,通过 ...
- Java自动化环境搭建笔记(1)
Java自动化环境搭建笔记(1) 自动化测试 先搭建java接口测试的环境: 使用mvn命令构建项目 测试集通过testNG.xml组织并运行 测试数据解耦,通过Excel等文件提供 基础依赖 创建m ...
随机推荐
- 用Python打印九九乘法表与金字塔(*)星号
''' 1*1=1 2*1=2 2*2=4 3*1=3 3*2=6 3*3=9 4*1=4 4*2=8 4*3=12 4*4=16 5*1=5 5*2=10 5*3=15 5*4=20 5*5=25 ...
- 数据库连接池 DBUtils:
import pymysqlfrom DBUtils.PooledDB import PooledDB, SharedDBConnectionPOOL = PooledDB ( creator=pym ...
- C 指针(pointer)
C 指针(pointer) /* * pointer.c * 指针在C中的应用 * */ #include <stdio.h> int main(void) { /* * i是一个int类 ...
- Fink| CEP
什么是复杂事件CEP? 一个或多个由简单事件构成的事件流通过一定的规则匹配,然后输出用户想得到的数据,满足规则的复杂事件. 特征: 目标:从有序的简单事件流中发现一些高阶特征 输入:一个或多个由简单事 ...
- 【2019.7.25 NOIP模拟赛 T3】树(tree)(dfs序列上开线段树)
没有换根操作 考虑如果没有换根操作,我们该怎么做. 我们可以求出原树的\(dfs\)序列,然后开线段树维护. 对于修改操作,我们可以倍增求\(LCA\),然后在线段树上修改子树内的值. 对于询问操作, ...
- Ubuntu无法正常输入英文单引号符号 + 误删除package导致系统设置异常(解决方案)
1 先说解决单引号的问题 写代码,遇到了输入英文单引号无法正常输入,需要按两次,而且不是竖向,而是斜的. 然后在寻找解决方案的过程中又遇到了把中文输入法搞得不能使用的问题.破费周折!!! 对Ubunt ...
- django 使用HttpResponse返回json数据为中文
之前我用django一般用JsonResponse来返回json数据格式 但是发现返回中文的时候会乱码 from django.http import JsonResponse def test(re ...
- python创建文件时去掉非法字符
1.函数作用 windows系统中文件名不能包含 \ / : * ? " < > |想要创建必须过滤掉这些字符 2.函数实现 import re def filename_fil ...
- spring 注解aop调用invoke()
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlAp ...
- LINQ 之 SelectMany
声明:本文为www.cnc6.cn原创,转载时请注明出处,谢谢! 一.第一种用法: public static IEnumerable<TResult> SelectMany<TSo ...