当前位置: 首页 > 知识库问答 >
问题:

应用程序在ios中启动和关闭,用于appium自动化

余善
2023-03-14

问题:在xcode中成功创建WebDriver代理,当我尝试运行我的代码时,ios应用程序启动并自动关闭。请帮我解决这个问题。环境Xcode版本=8.3.3 OSX 10.12.6 Appium版本1.6.4模拟器:iPhone SE 10.3成功地在xcode中创建了Web驱动程序代理,当我运行Appium服务器时,ipa文件(也尝试了. app文件)被启动并自动关闭。下面是我的代码

DesiredCapabilities cap= new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.IOS);
cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"10.3");
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone SE");          
cap.setCapability(MobileCapabilityType.UDID,
"813f6a5691bc091cb6653dc09176a107be
          108193");
    cap.setCapability("bundleId","com.dynamiteclothing.loyalty.dev");         


    cap.setCapability(MobileCapabilityType.APP,"/Users/testusers/Desktop/dynamite.ipa");
             IOSDriver driver = new driver(new URL("http://0.0.0.0:4723/wd/hub"),cap);
    cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "100");
Appium logs
[Appium] Welcome to Appium v1.6.4
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“automationName”:“XCUITest”,“bundleId”:“com.dynamiteclothing.loyalty.dev”,“platformName”:“iOS”,“deviceName”:“iPhone SE”,“platformVersion”:“10.3”}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“automationName”:“XCUITest”,“bundleId”:“com.dynamiteclothing.loyalty.dev”,“platformName”:“iOS”,“deviceName”:“iPhone SE”,“platformVersion”:“10.3”},null,null,null,null]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1505558554236 (16:12:34 GMT+0530 (IST))
[Appium] Creating new XCUITestDriver (v2.27.2) session
[Appium] Capabilities:
[Appium] automationName: ‘XCUITest’
[Appium] bundleId: ‘com.dynamiteclothing.loyalty.dev’
[Appium] platformName: ‘iOS’
[Appium] deviceName: ‘iPhone SE’
[Appium] platformVersion: ‘10.3’
[debug] [XCUITest] XCUITestDriver version: 2.27.2
[BaseDriver] Session created with session id: 7f722999-3e44-4ab1-bb62-78c75d5b2fff
[debug] [XCUITest] Xcode version set to ‘8.3.3’ (tools v8.3.2.0.1.1492020469)
[debug] [XCUITest] iOS SDK Version set to ‘10.3’
[debug] [BaseDriver] Event ‘xcodeDetailsRetrieved’ logged at 1505558554921 (16:12:34 GMT+0530 (IST))
[iOSSim] Constructing iOS simulator for Xcode version 8.3.3 with udid ‘F53C801A-D1FD-48A5-9910-2776673DE3A5’
[XCUITest] Determining device to run tests on: udid: ‘F53C801A-D1FD-48A5-9910-2776673DE3A5’, real device: false
[debug] [BaseDriver] Event ‘appConfigured’ logged at 1505558555750 (16:12:35 GMT+0530 (IST))
[debug] [BaseDriver] Event ‘resetStarted’ logged at 1505558555751 (16:12:35 GMT+0530 (IST))
[XCUITest] Path must be a string. Received undefined
[XCUITest] Reset: could not scrub application with id “com.dynamiteclothing.loyalty.dev”. Leaving as is.
[debug] [BaseDriver] Event ‘resetComplete’ logged at 1505558555834 (16:12:35 GMT+0530 (IST))
[debug] [iOSLog] Starting iOS 10.3 simulator log capture
[debug] [iOSLog] System log path: /Users/testuser/Library/Logs/CoreSimulator/F53C801A-D1FD-48A5-9910-2776673DE3A5/system.log
[debug] [BaseDriver] Event ‘logCaptureStarted’ logged at 1505558555983 (16:12:35 GMT+0530 (IST))
[XCUITest] Setting up simulator
[debug] [iOS] No reason to set locale
[debug] [iOS] No iOS / app preferences to set
[XCUITest] Simulator with udid ‘F53C801A-D1FD-48A5-9910-2776673DE3A5’ not booted. Booting up now
[debug] [iOSSim] Killing all iOS Simulators
[debug] [iOSSim] Simulator is not running. Continuing…
[iOSSim] Starting simulator with command: open -Fn /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID F53C801A-D1FD-48A5-9910-2776673DE3A5 -ConnectHardwareKeyboard 0
[iOSSim] Simulator booted in 46469ms
[debug] [BaseDriver] Event ‘simStarted’ logged at 1505558602578 (16:13:22 GMT+0530 (IST))
[debug] [BaseDriver] Event ‘appInstalled’ logged at 1505558602578 (16:13:22 GMT+0530 (IST))
[debug] [BaseDriver] Event ‘wdaStartAttempted’ logged at 1505558602580 (16:13:22 GMT+0530 (IST))
[XCUITest] Using WDA path: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[XCUITest] Using WDA agent: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: ‘/usr/local/bin/carthage’
[debug] [XCUITest] Killing hanging processes
[debug] [XCUITest] Beginning test with command ‘xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=F53C801A-D1FD-48A5-9910-2776673DE3A5 -configuration Debug IPHONEOS_DEPLOYMENT_TARGET=10.3’ in directory ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[debug] [XCUITest] Output from xcodebuild will not be logged
[debug] [XCUITest] Waiting up to 60000ms for WebDriverAgent to start
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [XCUITest] Log file for xcodebuild test: /Users/testuser/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/F9620691-B4F7-4971-B9A3-89863D0D8DDC/Session-WebDriverAgentRunner-2017-09-16_161331-UuT3NR.log
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: “{\n “value” : {\n “state” : “success”,\n “os” : {\n “name” : “iOS”,\n “version” : “10.3.1”\n },\n “ios” : {\n “simulatorVersion” : “10.3.1”,\n “ip” : “192.168.1.104”\n },\n “build” : {\n “time” : “Sep 12 2017 12:04:15”\n }\n },\n “sessionId” : “202DD193-C28A-49BC-AE97-549CE8741456”,\n “status” : 0\n}”
[debug] [XCUITest] WebDriverAgent running on ip ‘192.168.1.104’
[debug] [XCUITest] WebDriverAgent successfully started after 16949ms
[debug] [BaseDriver] Event ‘wdaSessionAttempted’ logged at 1505558619664 (16:13:39 GMT+0530 (IST))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {“desiredCapabilities”:{“bundleId”:“com.dynamiteclothing.loyalty.dev”,“arguments”:[],“environment”:{},“shouldWaitForQuiescence”:true,“shouldUseTestManagerForVisibilityDetection”:false,“maxTypingFrequency”:60,“shouldUseSingletonTestManager”:true}}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:“Failed to launch com.dynamiteclothing.loyalty.dev application”,“sessionId”:“202DD193-C28A-49BC-AE97-549CE8741456”,“status”:13}
[debug] [XCUITest] Failed to create WDA session. Retrying…
[debug] [BaseDriver] Event ‘wdaSessionAttempted’ logged at 1505558862184 (16:17:42 GMT+0530 (IST))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {“desiredCapabilities”:{“bundleId”:“com.dynamiteclothing.loyalty.dev”,“arguments”:[],“environment”:{},“shouldWaitForQuiescence”:true,“shouldUseTestManagerForVisibilityDetection”:false,“maxTypingFrequency”:60,“shouldUseSingletonTestManager”:true}}
[debug] [JSONWP Proxy] Got response with status 200: {“value”:“Failed to launch com.dynamiteclothing.loyalty.dev application”,“sessionId”:“202DD193-C28A-49BC-AE97-549CE8741456”,“status”:13}
[debug] [XCUITest] Failed to create WDA session. Retrying…
[debug] [BaseDriver] Event ‘wdaSessionAttempted’ logged at 1505559102153 (16:21:42 GMT+0530 (IST))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {“desiredCapabilities”:{“bundleId”:“com.dynamiteclothing.loyalty.dev”,“arguments”:[],“environment”:{},“shouldWaitForQuiescence”:true,“shouldUseTestManagerForVisibilityDetection”:false,“maxTypingFrequency”:60,“shouldUseSingletonTestManager”:true}}
[HTTP] <-- POST /wd/hub/session - - ms - -
[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“automationName”:“XCUITest”,“bundleId”:“com.dynamiteclothing.loyalty.dev”,“platformName”:“iOS”,“deviceName”:“iPhone SE”,“platformVersion”:“10.3”}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“automationName”:“XCUITest”,“bundleId”:“com.dynamiteclothing.loyalty.dev”,“platformName”:“iOS”,“deviceName”:“iPhone SE”,“platformVersion”:“10.3”},null,null,null,null]
[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1505559153667 (16:22:33 GMT+0530 (IST))

共有2个答案

常光明
2023-03-14

似乎您的ipa文件不是启用调试的构建。请与您的开发人员联系,以获得启用调试的ipa文件。

姜增
2023-03-14

这对我有帮助

在iOS中,您需要具有调试权限的应用程序。请与您的开发团队联系,为您的生成提供调试权限。

AppName.app(用于模拟器)和AppName.ipa(用于iphone/ipad物理设备)是使用Xcode IDE需要并创建的两个文件。您需要以调试/发布(在XCODE中)的形式构建应用程序-

请参见XCODE(窗口)-

http://discuss.appium.io/t/appium-test-on-ios-opens-and-close-the-application-over-and-over-again/8390/11

 类似资料:
  • 我在Cucumber自动化框架中使用Ruby来自动化我的Android和iOS应用程序。我正在使用Appium 1.6.4测试版,因为它支持iOS 10.2。 当Appium服务器首次在设备上安装iOS应用程序时,会出现一个警报对话框,询问是否允许通知。据我所知,使用Appium时,“自动接受器”功能目前不起作用。 我的主要问题是如何检查警报对话框是否存在,然后使用类似“查找元素”的功能按下“允许

  • 启动 1. 轻触主画面上您想启动的应用程序图标。 显示LiveArea™。 2. 轻触[开始]。 中断/继续 按下PS键即可返回LiveArea™。若要继续,请轻触[继续]。 关闭 1. 按下PS键。 返回LiveArea™。 2. 请由画面右上角将LiveArea™撕下。

  • 我最近开始研究iOS本机应用程序自动化- MAC OS 10.10.2iOS模拟器-iPhone 5s,iOS8.1 Appium 1.3.4 应用在应用商店中-我正在使用此应用商店应用的.App文件 Appium.app中的iOS设置-应用路径-为.app文件提供路径强制设备-模拟器设备 代码- 我还尝试只在代码中提供应用程序路径,但没有在appium.app中提供,我尝试使用和不使用应用程序的

  • 我正在使用此代码,无法在我的移动设备上启动应用程序 TLDR: 原始错误:活动名称'。用于启动应用程序的SplashActivity不存在或无法启动!确保它存在并且是可启动的活动 下面是我的错误日志 log4j:WARN找不到记录器(org.apache.http.client.protocol.RequestAddCookies)的追加器。log4j:警告请正确初始化log4j系统。log4j:

  • 我正在运行一个spring启动应用程序,除了尝试关闭它之外,一切都很好。我在下面的代码中出错 该错误在最后一行生成,spring boot将在2秒等待完成之前关闭level2List,如下所示 是否有任何方法可以命令关闭过程,或确保在关闭之前我没有使用level2List? 沙布尔酒店

  • 我已经安装了Appium和所有必要的东西,通过iOS模拟器运行应用程序 然后我启动了一个模拟器并启动了Appium(确保在启动前在设置中设置了应用程序的路径) 我不知道应用程序是否应该在启动后立即开放。这就是为什么我运行督察。似乎设备已连接,应用程序的安装已启动。显示启动屏幕后,应用程序崩溃了。我用另一个应用程序尝试了同样的流程,得到了同样的结果。以下是Appium的日志: