Appium Inspector未连接到应用程序

时间:2018-01-03 15:39:56

标签: ios appium inspector

我正在尝试在我的本地计算机上打开一个appium检查器会话,但是我收到了这个错误:

Appium] Welcome to Appium v1.7.1
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/sessions {}
[MJSONWP] Calling AppiumDriver.getSessions() with args: []
[MJSONWP] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 8 ms - 40 
[HTTP] --> GET /wd/hub/sessions {}
[MJSONWP] Calling AppiumDriver.getSessions() with args: []
[MJSONWP] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 13 ms - 40 
[HTTP] --> GET /wd/hub/sessions {}
[MJSONWP] Calling AppiumDriver.getSessions() with args: []
[MJSONWP] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 13 ms - 40 
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/haroonnaderi/Desktop/WebView.ipa","deviceName":"iPhone Simulator","noReset":true,"platformName":"iOS","platformVersion":"11.2","showXcodeLog":true,"useNewWDA":true,"newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/haroonnaderi/Desktop/WebView.ipa","deviceName":"iPhone Simulator","noReset":true,"platformName":"iOS","platformVersion":"11.2","showXcodeLog":true,"useNewWDA":true,"newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1514939642784 (16:34:02 GMT-0800 (PST))
[Appium] Requested iOS support with version >= 10, using XCUITest driver instead of UIAutomation-based driver, since the latter is unsupported on iOS 10 and up.
[Appium] Creating new XCUITestDriver (v2.51.1) session
[Appium] Capabilities:
[Appium]   app: '/Users/haroonnaderi/Desktop/WebView.ipa'
[Appium]   deviceName: 'iPhone Simulator'
[Appium]   noReset: true
[Appium]   platformName: 'iOS'
[Appium]   platformVersion: '11.2'
[Appium]   showXcodeLog: true
[Appium]   useNewWDA: true
[Appium]   newCommandTimeout: 0
[Appium]   connectHardwareKeyboard: true
[BaseDriver] Session created with session id: 112da0db-de59-4ec6-9274-0d0141943b92
[XCUITest] Xcode version set to '9.2' (tools v9.2.0.0.1.1510905681)
[XCUITest] iOS SDK Version set to '11.2'
[BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1514939642987 (16:34:02 GMT-0800 (PST))
[XCUITest] Changing deviceName from 'iPhone Simulator' to 'iPhone 6'
[iOSSim] Constructing iOS simulator for Xcode version 9.2 with udid '4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218'
[XCUITest] Determining device to run tests on: udid: '4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218', real device: false
[BaseDriver] Using local app '/Users/haroonnaderi/Desktop/WebView.ipa'
[BaseDriver] Copying local zip to tmp dir
[BaseDriver] Unzipping /var/folders/0s/hqdpyw0j08d_blg1fx2fygsr0000gn/T/201802-15290-1peg17v.s8kccba9k9/appium-app.zip
[BaseDriver] Testing zip archive: /var/folders/0s/hqdpyw0j08d_blg1fx2fygsr0000gn/T/201802-15290-1peg17v.s8kccba9k9/appium-app.zip
[BaseDriver] Unzipped local app to '/var/folders/0s/hqdpyw0j08d_blg1fx2fygsr0000gn/T/201802-15290-1peg17v.s8kccba9k9/Payload/WebView Test.app'
[BaseDriver] Event 'appConfigured' logged at 1514939643653 (16:34:03 GMT-0800 (PST))
[XCUITest] Checking whether app '/var/folders/0s/hqdpyw0j08d_blg1fx2fygsr0000gn/T/201802-15290-1peg17v.s8kccba9k9/Payload/WebView Test.app' is actually present on file system
[XCUITest] App is present
[iOS] Getting bundle ID from app '/var/folders/0s/hqdpyw0j08d_blg1fx2fygsr0000gn/T/201802-15290-1peg17v.s8kccba9k9/Payload/WebView Test.app': 'com.hnbs.WebView-Test'
[BaseDriver] Event 'resetStarted' logged at 1514939643676 (16:34:03 GMT-0800 (PST))
[XCUITest] Reset: noReset is on. Leaving simulator as is
[BaseDriver] Event 'resetComplete' logged at 1514939643677 (16:34:03 GMT-0800 (PST))
[iOSLog] Starting iOS 11.2 simulator log capture
[iOSLog] System log path: /Users/haroonnaderi/Library/Logs/CoreSimulator/4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218/system.log
[BaseDriver] Event 'logCaptureStarted' logged at 1514939643817 (16:34:03 GMT-0800 (PST))
[XCUITest] Setting up simulator
[iOS] No reason to set locale
[iOS] No iOS / app preferences to set
[iOSSim] Setting common Simulator preferences to {"ConnectHardwareKeyboard":true}
[iOSSim] Updated shared Simulator preferences at '/Users/haroonnaderi/Library/Preferences/com.apple.iphonesimulator.plist' with {"ConnectHardwareKeyboard":true}
[iOSSim] The count of running Simulator UI client instances is 0
[iOSSim] Booting Simulator with UDID 4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218...
[iOSSim] Starting Simulator UI with command: open -Fn /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID 4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218 -ConnectHardwareKeyboard 1
[iOSSim] The count of running Simulator UI client instances is 1
[iOSSim] Simulator with UDID 4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218 booted in 24 seconds
[BaseDriver] Event 'simStarted' logged at 1514939668953 (16:34:28 GMT-0800 (PST))
[XCUITest] App 'com.hnbs.WebView-Test' is already installed. No need to reinstall.
[BaseDriver] Event 'appInstalled' logged at 1514939669788 (16:34:29 GMT-0800 (PST))
[XCUITest] Using WDA path: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Using WDA agent: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
[XCUITest] Capability 'useNewWDA' set to true, so uninstalling WDA before proceeding
[XCUITest] Shutting down sub-processes
[XCUITest] Removing WDA application from device
[BaseDriver] Event 'wdaUninstalled' logged at 1514939672408 (16:34:32 GMT-0800 (PST))
[BaseDriver] Event 'wdaStartAttempted' logged at 1514939672412 (16:34:32 GMT-0800 (PST))
[XCUITest] Launching WebDriverAgent on the device
[XCUITest] Carthage found: '/usr/local/bin/carthage'
[XCUITest] Killing running processes 'xcodebuild.*4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218, iproxy 8100, 4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218.*XCTRunner' for the device 4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218...
[XCUITest] 'pgrep -nif xcodebuild.*4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218' didn't detect any matching processes. Return code: 1
[XCUITest] 'pgrep -nif iproxy 8100' didn't detect any matching processes. Return code: 1
[XCUITest] 'pgrep -nif 4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218.*XCTRunner' didn't detect any matching processes. Return code: 1
[XCUITest] Using Xcode 9.2, so fixing WDA codebase
[XCUITest] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218 IPHONEOS_DEPLOYMENT_TARGET=11.2' in directory '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Output from xcodebuild will be logged. To see xcode logging, use 'showXcodeLog' desired capability
[Xcode] Build settings from command line:
[Xcode] 
[XCUITest] Waiting up to 60000ms for WebDriverAgent to start
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[Xcode]     IPHONEOS_DEPLOYMENT_TARGET = 11.2
[Xcode] 
[Xcode] 
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[Xcode] === BUILD TARGET WebDriverAgentLib OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===
[Xcode] 
[Xcode] 
[Xcode] 
[Xcode] 
[Xcode] Check dependencies
[Xcode] 
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[Xcode] 
[Xcode] 
[Xcode] === BUILD TARGET WebDriverAgentRunner OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===
[Xcode] 
[Xcode] 
[Xcode] Check dependencies
[Xcode] 
[Xcode] 
[Xcode] 
[Xcode] ** TEST BUILD SUCCEEDED **
[Xcode] 
[Xcode] 
[XCUITest] Log file for xcodebuild test: /var/folders/0s/hqdpyw0j08d_blg1fx2fygsr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-C4E50138-7963-4E50-9E87-5E0235A18F86/WebDriverAgentRunner-6A750461-303B-48FA-9A69-691803753120/Session-WebDriverAgentRunner-2018-01-02_163441-TDxxwq.log
[Xcode] 2018-01-02 16:34:41.626 xcodebuild[15977:644204]  IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
[Xcode] /var/folders/0s/hqdpyw0j08d_blg1fx2fygsr0000gn/T/com.apple.dt.XCTest/IDETestRunSession-C4E50138-7963-4E50-9E87-5E0235A18F86/WebDriverAgentRunner-6A750461-303B-48FA-9A69-691803753120/Session-WebDriverAgentRunner-2018-01-02_163441-TDxxwq.log
[Xcode] 
[Xcode] 2018-01-02 16:34:41.628 xcodebuild[15977:644045] [MT] IDETestOperationsObserverDebug: (EE11AE25-8D70-4187-B122-33281CA5D5D7) Beginning test session WebDriverAgentRunner-EE11AE25-8D70-4187-B122-33281CA5D5D7 at 2018-01-02 16:34:41.627 with Xcode 9C40b on target  {
[Xcode]         SimDevice: iPhone 6 (4CD1A28A-9305-4E4A-AC48-5B5F5CAC1218, iOS 11.2, Booted)
[Xcode] } (11.2 (15C107))
[Xcode] 
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Got response with status 200: "{\n  \"value\" : {\n    \"state\" : \"success\",\n    \"os\" : {\n      \"name\" : \"iOS\",\n      \"version\" : \"11.2\"\n    },\n    \"ios\" : {\n      \"simulatorVersion\" : \"11.2\",\n      \"ip\" : \"10.33.110.179\"\n    },\n    \"build\" : {\n      \"time\" : \"Jan  2 2018 14:11:22\"\n    }\n  },\n  \"sessionId\" : \"F8D9C4DB-FD04-490E-921F-7C777B905551\",\n  \"status\" : 0\n}"
[XCUITest] WebDriverAgent running on ip '10.33.110.179'
[XCUITest] WebDriverAgent successfully started after 17999ms
[BaseDriver] Event 'wdaSessionAttempted' logged at 1514939690641 (16:34:50 GMT-0800 (PST))
[XCUITest] Sending createSession command to WDA
[JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.hnbs.WebView-Test","arguments":[],"environment":{},"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
[JSONWP Proxy] Got response with status 200: {"value":"Failed to launch com.hnbs.WebView-Test application","sessionId":"F8D9C4DB-FD04-490E-921F-7C777B905551","status":13}
[XCUITest] Failed to create WDA session. Retrying...

我已经坚持了一段时间,似乎没有任何关于此的好文档,我将不胜感激任何帮助。我在日志中删除了一些重复的行,以便我可以发布这个。我删除的行只是重复:[JSONWP Proxy] Got response with status 200: {"value":"Failed to launch com.hnbs.WebView-Test application","sessionId":"F8D9C4DB-FD04-490E-921F-7C777B905551","status":13} [XCUITest] Failed to create WDA session. Retrying...

2 个答案:

答案 0 :(得分:0)

您使用的是Appium Desktop(https://github.com/appium/appium-desktop/releases)还是命令行appium?我遇到了一个问题,WebDriverAgent没有安装在模拟器上,命令行版本为appium(/ usr / local / bin / appium)。我通过npm install -g appiumnpm install -g appium@1.7.1尝试了,但都失败了。如果我从Appium Desktop运行appium服务器,WebDriverAgent安装正常并启动。我最终通过从/ Applications目录启动appium来解决这个问题。

在我的剧本中我有这个:

DIR=`pwd`
LOG=$DIR/reports/appium_server_output.txt
APPIUM_LOG=$DIR/reports/appium_output.txt
APPIUM_APP_MODULES=/Applications/Appium.app/Contents/Resources/app/node_modules
export NODE_PATH=$APPIUM_APP_MODULES:$NODE_PATH
$APPIUM_APP_MODULES/appium/build/lib/main.js --address 127.0.0.1 --port 4723 --default-capabilities '{"platformName": "iOS"}' --session-override --log $LOG > $APPIUM_LOG 2>&1 &

在我刚刚发布'appium'之前。

答案 1 :(得分:0)

如果您在模拟器上运行测试,请尽量不要使用bundleID。这应该没有bundleID