2018-08-18 iOS

git clone https://github.com/facebook/WebDriverAgent

下载项目:
git clone https://github.com/appium/ios-uicatalog

ios-predicate: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios/ios-predicate.md

ios-gestures: https://github.com/appium/appium/blob/master/docs/cn/writing-running-appium/ios-xctest-mobile-gestures.md

ios-webview: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/ios-webkit-debug-proxy.md

自动化测试,都是用.app的包;
.app又要分情况

  • 1、分给模拟器用 x86
    xcodebuild -project UICatalog.xcodeproj -target UICatalog -sdk iphonesimilator11.2 -configuration Development
  • 2、给真机用 arm
    xcodebuild -project UICatalog.xcodeproj -target UICatalog -sdk iphoneos11.2 -configuration Development

{
“platformVersion”: “11.2”,
“app”: “xxxx/ios-uicatalog/build/Release-iphonesimulator/UICatalog.app”,
“platformName”: “iOS”,
“deviceName”: “iPhone 8 Plus”
}


from appium import webdriver

caps = {}
caps["platformVersion"] = "11.2"
caps["bundleId"] = 'com.examplex.apple-samplecode.UICatalog'
caps["platformName"] = "iOS"
caps["deviceName"] = "iPhone 8 Plus"

driver = webdriver.Remote("http://192.168.50.216:4723/wd/hub", caps)
driver.implicitly_wait(10)

el1 = driver.find_element_by_accessibility_id("Buttons")
el1.click()
el2 = driver.find_element_by_xpath("//XCUIElementTypeApplication[@name=\\"UICatalog\\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[1]")
el2.click()
els1 = driver.find_elements_by_ios_predicate("label == 'UICatalog'")
els1[1].click()

driver.quit()

\b远程调试ios webview需要安装的

brew install libimobiledevice  (必须,已安装过可略过)
brew install ios-webkit-debug-proxy
ios_webkit_debug_proxy -f chrome-devtools://devtools/bundled/inspector.html

作业1:
使用真机,运行真机中的一个具体的App,并使用ios-predicate进行元素定位;

作业2:
IWDA的安装,并完成uicatalog中webview页面的元素获取与点击

作业3:
继续完善start appium server的开发;