依赖
- ios-deploy
- https://github.com/google/ios-webkit-debug-proxy
- http://appium.io/docs/en/drivers/ios-xcuitest-real-devices/
- idevicescreenshot
WebDriverAgent的安装与启动
git clone https://github.com/facebook/WebDriverAgent.git
cd WebDriverAgent/
#构建
bash -x ./Scripts/bootstrap.sh
#启动模拟器的应用
xcodebuild -project WebDriverAgent.xcodeproj \\
-scheme WebDriverAgentRunner \\
-destination 'platform=iOS Simulator,name=iPhone 6' \\
test
#启动真机
xcodebuild -project WebDriverAgent.xcodeproj \\
-scheme WebDriverAgentRunner \\
-destination 'platform=iOS,name=Uzumaki的 iPhone' \\
test
appium运行的命令
xcodebuild \\
build-for-testing \\
test-without-building \\
-project /usr/local/lib/node_modules/appium/node_modules/_appium-xcuitest-driver@2.104.0@appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj \\
-scheme WebDriverAgentRunner \\
-destination id=c894720cd2413dc52b1fc2d94f92b1f78b905e31 \\
-xcconfig /var/folders/mk/xf15bt7n07b5p0z1g3n0c1300000gq/T/201927-24091-5qjb7i.9w3vq/appium-temp.xcconfig
xcconfig
DEVELOPMENT_TEAM = 96NJEQL7Y2
CODE_SIGN_IDENTITY = iPhone Developer
真机
def test_uicatalog_real_by_url(self):
caps = {}
caps["platformName"] = "ios"
caps["automationName"] = "xcuitest"
caps["deviceName"] = "Uzumaki的iPhone"
caps["udid"]="auto"
caps["app"] = '/Users/seveniruby/Library/Developer/Xcode/DerivedData/UICatalog-dfavfehsvaabuqdpmxouzqphclvl/' \\
'Build/Products/Debug-iphoneos/UICatalog.app'
caps["xcodeOrgId"]="96NJEQL7Y2"
caps["xcodeSigningId"]="iPhone Developer"
caps["webDriverAgentUrl"]="http://192.168.0.102:8100"
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
self.driver.implicitly_wait(10)
print(self.driver.page_source)
def test_uicatalog_real(self):
caps = {}
caps["platformName"] = "ios"
caps["automationName"] = "xcuitest"
caps["deviceName"] = "Uzumaki的iPhone"
caps["udid"]="auto"
caps["app"] = '/Users/seveniruby/Library/Developer/Xcode/DerivedData/UICatalog-dfavfehsvaabuqdpmxouzqphclvl/' \\
'Build/Products/Debug-iphoneos/UICatalog.app'
caps["xcodeOrgId"]="96NJEQL7Y2"
caps["xcodeSigningId"]="iPhone Developer"
#加速,绕过构建
caps["usePrebuiltWDA"]="true"
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
self.driver.implicitly_wait(10)
print(self.driver.page_source)
iOS常见问题
Failed to create provisioning profile.
The app ID "com.appium.apple-samplecode.UICatalog" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.
Provisioning profile "iOS Team Provisioning Profile: *" doesn't include the currently selected device "Uzumaki的 iPhone".
Testing failed:
\tSigning for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor. (in target 'WebDriverAgentRunner')
\tTesting cancelled because the build failed.
设置苹果开发者账号
Testing failed:
\tWebDriverAgentRunner-Runner.app encountered an error (Failed to install or launch the test runner. (Underlying error: App installation failed. This application’s application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed.)
以前安装过老版本的app,需要提前删除