Bob's Blog

Web开发、测试框架、自动化平台、APP开发、机器学习等

返回上页首页

Mac上配置appium环境



需要对iphone和android同时做自动化测试,于是选择了appium。虽然慢,不过可以跨平台。

在mac上先保证HomeBrew是安装了的,如果没有安装,可以运行下面的命令: 

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后运行如下的命令来安装相应环境:

brew install libimobiledevice
brew install ideviceinstaller
brew install ios-webkit-debug-proxy
brew install ios-deploy
brew install carthage
brew install node

此时再安装appium,并检查环境是否正常:

npm install -g appium
npm install -g appium-doctor
Appium-doctor --ios

如果需要做iphone上的自动化测试,记得安装xcode。

在appium的目录下有webdriveragent,需要build和test,安装后的路径是/usr/local/lib/node_modules/appium。

在其中的目录下node_modules/appium-webdriveragent, 运行./Scripts/bootstrap.sh。

运行完成后,用xcode打开WebDriverAgent.xcodeproj。

后续步骤可以参考这个链接的内容:https://testerhome.com/topics/7220。

 

如果出现了这个错误:Module parse failed: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Inspector/js/app.js Unexpected token (67:6),那么修改Inspector下webpack.config.js文件,去掉babel-loader配置后的,“exclude: /node_modules/”, 删除Inspector下node_modules文件夹,再执行 “sh ./Scripts/bootstrap.sh”。

如果遇到错误:The bundle identifier for IntegrationApp.app couldn’t be read. 那么将目录/Users/username/Library/Developer/Xcode/DerivedData下的WebDriverAgent-开头的文件夹删除掉,然后再次运行product-test即可。

 

当环境准备好了后,比如用iphone时,用数据线插上手机,运行:ios_webkit_debug_proxy -c <iphone udid>:27753 -d; 再运行appium来启动appium server,就可以开始编写你的脚本啦。

如果是想对safari做自动化测试,还需要安装SafariLauncher。

当需要指定bundleId时,可以用ideviceinstaller -l来获取手机安装app的bundleId。

需要注意的是,真机需要有效的开发分发证书和开发的 Provisioning Profile。

下一篇:  Selenium Webdriver做自动化时一些有用的js操作
上一篇:  django上传文件500错误但本地server不出现错误的问题

共有0条评论

添加评论

暂无评论