appium:1.4.13
xcode:7.1
ios:9.1
desired_caps = dict()
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '9.1'
desired_caps['deviceName'] = 'iPhone 6'
desired_caps['app'] = os.path.abspath('/Users/Test.app')
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
即使附加了真实的设备,也总是推出模拟器。
我正试图在设备上运行。
模拟器不停地推进和关闭。
info: [debug] Starting command proxy.
info: [debug] Instruments socket server started at /tmp/instruments_sock
info: [debug] Starting instruments
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (9.1) [
info: On xcode 7.0, instruments-without-delay does not work, skippinginstruments-without-delay
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (9.1) [" /Users/Test.app -e UIASCRIPT "/Users/Library/Application Support/appium/bootstrap/bootstrap-bf740a9394e481ef.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST] Waiting for device to boot...
info: [debug] [INST STDERR] 2015-10-21 13:29:31.895 instruments[3192:50268] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST STDERR] 2015-10-21 13:29:53.976 instruments[3192:50261] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] 2015-10-21 13:29:53.976 instruments[3192:51306] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier 'com.apsalar.sdkBatchTest2'
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #1
info: [debug] Killall Simulator
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (9.1) [
info: On xcode 7.0, instruments-without-delay does not work, skippinginstruments-without-delay
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 6 (9.1) [" /Users/Test.app -e UIASCRIPT "/Users/Library/Application Support/appium/bootstrap/bootstrap-bf740a9394e481ef.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST STDERR] 2015-10-21 13:30:00.033 instruments[3298:51578] **WebKit Threading Violation - initial use of WebKit from a secondary thread.**
info: [debug] [INST] Waiting for device to boot...
info: [debug] [INST STDERR] 2015-10-21 13:30:07.851 instruments[3298:51576] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] 2015-10-21 13:30:07.851 instruments[3298:51577] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier 'com.apsalar.sdkBatchTest2'
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
答案 0 :(得分:0)
添加udid工作!!
desired_caps = dict()
desired_caps['platformName'] = 'iOS'
desired_caps['platformVersion'] = '9.1'
desired_caps['deviceName'] = 'iPhone 6'
desired_caps['udid'] = '09d905a109245efebd23ab741c0900e83769b3ae'
desired_caps['app'] = os.path.abspath('/Users/Test.app')
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
答案 1 :(得分:0)
添加“udid”功能并在那里输入你的设备。
capabilities.setCapability("deviceName", "phoneUDID");
答案 2 :(得分:0)
1)首先:启用iOS设备的UIAutomation>开发人员>启用UI自动化
2)使用真实设备UDID启动Appium实例
喜欢:节点。 -p 4725 -bp 2553 -U“”
3)并在测试代码中添加功能如下:
File rootDir = new File(System.getProperty("user.dir"));
File appDir = new File(rootDir, "folder");
File app = new File(appDir, AppName);
DesiredCapabilities capabilities = new DesiredCapabilities();
/*Capabilities for Simulator*/
// capabilities.setCapability("deviceName", "iPhone 6");
/*Capabilities for Simulator*/
/*Capabilities for Device*/
capabilities.setCapability("deviceName", "Wasim~iPhone");
/*Capabilities for Device*/
capabilities.setCapability("platformVersion", "9.1");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("autoAcceptAlerts",true); //this auto accepts the Notification alert
capabilities.setCapability("platformVersion", "9.1");
capabilities.setCapability("noReset",true);
if (isfirstTimeStart) {
capabilities.setCapability("app", app.getAbsolutePath());
}else {
capabilities.setCapability("bundleId", bundleId);
}
driver = new AppiumDriver(new URL("http://127.0.0.1:4725/wd/hub"), capabilities);
因此,在运行appium服务器实例时,DeviceName在设备上运行非常重要,而且在运行appium服务器实例时也是如此。