1.能够搭建ios自动化测试所需要的环境
2.使用ios模拟器Simulator进行ios自动化测试
3.使用真机进行ios自动化测试
版本10.13.6以上
版本10.1以上
自己拉代码,自己能够打包到手机里
https://github.com/appium/appium-desktop/releases/download/
版本3.6.1以上
编辑器,其他的也可以
https://npm.taobao.org/mirrors/node 网上下载
安装node库插件的,安装完后就有了npm命令
npm install -g cnpm --registry=https://registry.npm.taobao.org
跟npm命令一样,但是比npm速度快
cnpm install -g ios-deploy
ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
mac都自带,源自于ruby
brew install --HEAD libimobiledevice
报错:Requested ‘libusbmuxd >= 1.1.0’ but version of libusbmuxd is 1.0.10 解决方法:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install carthage
https://github.com/facebook/WebDriverAgent
点击 download zip
1.准备个ios手机,ios12.1以上的
2.注册个appid
command +r 或者xcode上面选择
就是识别元素用的
1.打开appium
2.启动服务
3.左上角,appium-new session window
4.填入参数
platformName iOS
platformVersion 设备的系统版本
deviceName iPhone几
app bundle,也叫包名
5.启动就行了
app会启动,然后能看到UI界面
前置代码:
from appium import webdriver
desired_caps = dict()
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '12.1'
desired_caps['deviceName'] = 'iPhone 8'
desired_caps['app'] = 'com.itcast.HMiOSTest'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
业务代码:
根据你的需求来写,推荐只是用id和xpath来定位
比如 //*[@text=‘哈哈’] xpath定位比较准,但是相比下速度慢一点
xpath的//*是相对定位,绝对定位是界面上显示的一个特别长/的路径,不要用
滑动:
driver.execute_script(“mobile: swipe”, {“direction”: “up”})
2.driver.swipe(100, 600, 100, 30) 从(100,600)滑到(100,30)
https://gochannel.org/links/link/snapshot/4307 https://testerhome.com/topics/6962 https://blog.csdn.net/weixin_35825766/article/details/80655296 https://blog.csdn.net/yjs_13597468160/article/details/80635761 https://testerhome.com/topics/14911 https://www.jianshu.com/p/1ec36db7d551
https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/touch-actions. md#bugs-and-workarounds