gpt4 book ai didi

java - Appium如何在物理设备上运行

转载 作者:行者123 更新时间:2023-11-29 12:17:55 25 4
gpt4 key购买 nike

所以我试图在真实的物理设备上运行我的测试,但它总是说仪器在启动时崩溃。这是错误代码

info: [debug] Attempting to run app on real device with UDID 70cb6f4fd5e313b16742c083ccbc1897d82b094d
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 70cb6f4fd5e313b16742c083ccbc1897d82b094d com.weather.corp.TWC -e UIASCRIPT "/Users/michael.kovalsky/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {"global":90000}

info: [debug] [INSTSERVER] Instruments exited with code 253

info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
info: [debug] Stopping iOS log capture
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iOS Simulator
info: [debug] Killing any other simulator daemons

error: Failed to start an Appium session, err was: Error: Instruments crashed on startup

info: [debug] On a real device; cannot clean device state
info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:389:31)
at null.<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:308:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
info: <-- POST /wd/hub/session 500 19219.862 ms - 182

And this is how my setUp method looks like:

public void setUp() throws FileNotFoundException, IOException, IllegalMonitorStateException
{

//Users/user/Library/Developer/Xcode/DerivedData/iPhone-aowtfpozolcnpigbxzxxxxkyiubq/Build/Products/Debug-iphonesimulator/TheWeather.app
File app = new File("/Users/michael.kovalsky/Library/Developer/Xcode/DerivedData/iPhone-aowtfpozolcnpigbxzxxxxkyiubq/Build/Products/Debug-iphonesimulator/TheWeather.app");


DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "iOS");

capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "8.3");

capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6 Plus");

capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability("bundleID", "com.weather.corp.TWC");
capabilities.setCapability("udid", "70cb6f4fd5e313b16742c083ccbc1897d82b094d");


driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);

logger.info("Environment: iOS 8.3 and iPhone 6 plus Simulator");

}

如果我注释掉我的“udid”,那么模拟器会正常启动,但它根本不会启动。但是,我需要它启动到我连接到机器的设备。我错过了一些简单的东西吗?

最佳答案

您可能缺少 ios webkit 代理。引用这个Link它包括从安装到运行的完整文档。

在运行测试之前也启动代理。

关于java - Appium如何在物理设备上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31542431/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com