XCUITest - "Underlying error: The operation couldn’t be completed. Permission denied" "Connection was refused to port 8100"

Hello, I have a issue with ios.

Appium 1.16.0
Iphone Xs max 13.3
MacOS Catalina 10.15.2
Xcode 11.3.1

capps:

  "automationName": "XCUITest",
  "udid": "auto",
  "platformVersion": "13.3",
  "startIWDP": true,
  "useNewWDA": true,
  "xcodeOrgId": "ID",
  "xcodeSigningId": "iPhone Developer",

I configure xcode project /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/ and /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/ according to man http://appium.io/docs/en/drivers/ios-xcuitest-real-devices/

./Scripts/bootstrap.sh -d

Strange, but I do not have a directory WebDriverAgent.

deployer@Mac-mini-vuzdsnuk appium-webdriveragent % pwd
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent
deployer@Mac-mini-vuzdsnuk appium-webdriveragent %     mkdir -p Resources/WebDriverAgent.bundle                                          

deployer@Mac-mini-vuzdsnuk appium-webdriveragent %     ./Scripts/bootstrap.sh -d                                                         

Fetching dependencies

deployer@Mac-mini-vuzdsnuk appium-webdriveragent % pwd
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent
deployer@Mac-mini-vuzdsnuk appium-webdriveragent %     mkdir -p Resources/WebDriverAgent.bundle

deployer@Mac-mini-vuzdsnuk appium-webdriveragent %     ./Scripts/bootstrap.sh -d

Fetching dependencies

Run appium and tests

[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[iProxy@00008020] Error: Connection was refused to port 8100
[iProxy@00008020]     at Usbmux.connect (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-ios-device/lib/usbmux/index.js:207:13)
[iProxy@00008020]     at Object.connectPort (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-ios-device/lib/utilities.js:163:12)
[iProxy@00008020]     at Server.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/device-connections-factory.js:23:24)
[WD Proxy] Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[iProxy@00008020] Error: Connection was refused to port 8100
[iProxy@00008020]     at Usbmux.connect (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-ios-device/lib/usbmux/index.js:207:13)
[iProxy@00008020]     at Object.connectPort (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-ios-device/lib/utilities.js:163:12)
[iProxy@00008020]     at Server.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/device-connections-factory.js:23:24)
[WD Proxy] Got an unexpected response with status undefined: {"code":"ECONNRESET"}
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [XCUITest] Log file for xcodebuild test: /Users/deployer/Library/Developer/Xcode/DerivedData/WebDriverAgent-aiaejbhejflmruhkhsmeebmhbaia/Logs/Test/Test-WebDriverAgentRunner-2020.01.16_06-10-21--0800.xcresult/Staging/2_Test/Diagnostics/WebDriverAgentRunner-4567054D-F649-4C65-92CA-0DBF94670564/WebDriverAgentRunner-478C3EFA-BC80-4294-80B2-961E51F522DD/Session-WebDriverAgentRunner-2020-01-16_061022-sNKcZc.log
[Xcode] 2020-01-16 06:10:23.080 xcodebuild[4194:71171] Error Domain=NSCocoaErrorDomain Code=257 "The file “WebDriverAgentRunner-Runner” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/Users/deployer/Library/Developer/Xcode/DerivedData/WebDriverAgent-aiaejbhejflmruhkhsmeebmhbaia/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app, NSUnderlyingError=0x7fe808706230 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[Xcode] 
[Xcode] 
[Xcode] Test session results, code coverage, and logs:
[Xcode] 	/Users/deployer/Library/Developer/Xcode/DerivedData/WebDriverAgent-aiaejbhejflmruhkhsmeebmhbaia/Logs/Test/Test-WebDriverAgentRunner-2020.01.16_06-10-21--0800.xcresult
[Xcode] 
[Xcode] 
[Xcode] Testing started on 'iPhone'
[Xcode] 
[Xcode] Testing failed:
[Xcode] 	Command CodeSign failed with a nonzero exit code
[Xcode] 	WebDriverAgentRunner:
[Xcode] 		WebDriverAgentRunner-Runner.app encountered an error (Failed to install or launch the test runner. (Underlying error: The file “WebDriverAgentRunner-Runner” couldn’t be opened because you don’t have permission to view it. You don’t have permission. (Underlying error: The operation couldn’t be completed. Permission denied)))
[Xcode] 
[Xcode] ** TEST EXECUTE FAILED **
[Xcode] 
[Xcode] 
[XCUITest] xcodebuild exited with code '65' and signal 'null'
[XCUITest] Launching WebDriverAgent on the device
[WebDriverAgent] Fetching dependencies
[WebDriverAgent] Dependencies up-to-date
[debug] [XCUITest] Killing running processes 'xcodebuild.*00008020-00110C300A62002E' for the device 00008020-00110C300A62002E...
[debug] [XCUITest] 'pgrep -ifn xcodebuild.*00008020-00110C300A62002E' didn't detect any matching processes. Return code: 1
[debug] [XCUITest] Using Xcode configuration file: '/var/folders/k7/fwp487cj6tb6hl5jdpzm61800000gn/T/2020016-1890-nnnfmn.o5fpa/appium-temp.xcconfig'
[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/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/deployer/Library/Developer/Xcode/DerivedData/WebDriverAgent-aiaejbhejflmruhkhsmeebmhbaia -destination id=00008020-00110C300A62002E IPHONEOS_DEPLOYMENT_TARGET=13.3 -xcconfig /var/folders/k7/fwp487cj6tb6hl5jdpzm61800000gn/T/2020016-1890-nnnfmn.o5fpa/appium-temp.xcconfig GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[debug] [XCUITest] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability
[XCUITest] ** TEST EXECUTE FAILED **. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[XCUITest]     at quitAndUninstall (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:519:15)
[XCUITest]     at /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:549:11
[XCUITest]     at wrapped (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:35:13)
[XCUITest]     at retry (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:18:13)
[XCUITest]     at retryInterval (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:45:10)
[XCUITest]     at /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:529:7
[DevCon Factory] Releasing connections for 00008020-00110C300A62002E device on any port number
[DevCon Factory] Found cached connections to release: ["00008020-00110C300A62002E:8100"]
[DevCon Factory] Releasing the listener for '00008020-00110C300A62002E:8100'
[debug] [DevCon Factory] Cached connections count: 0
[debug] [XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1579183830503 (06:10:30 GMT-0800 (Pacific Standard Time))
[debug] [W3C] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
[debug] [W3C] xcodebuild error message:
[debug] [W3C] 
[debug] [W3C] 2020-01-16 06:10:30.092 xcodebuild[4203:71463] Error Domain=NSCocoaErrorDomain Code=257 "The file “WebDriverAgentRunner-Runner” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/Users/deployer/Library/Developer/Xcode/DerivedData/WebDriverAgent-aiaejbhejflmruhkhsmeebmhbaia/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app, NSUnderlyingError=0x7f9714d489b0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
[debug] [W3C] Test session results, code coverage, and logs:
[debug] [W3C] 	/Users/deployer/Library/Developer/Xcode/DerivedData/WebDriverAgent-aiaejbhejflmruhkhsmeebmhbaia/Logs/Test/Test-WebDriverAgentRunner-2020.01.16_06-10-28--0800.xcresult
[debug] [W3C] Testing started on 'iPhone'
[debug] [W3C] Testing failed:
[debug] [W3C] 	Command CodeSign failed with a nonzero exit code
[debug] [W3C] 	WebDriverAgentRunner:
[debug] [W3C] 		WebDriverAgentRunner-Runner.app encountered an error (Failed to install or launch the test runner. (Underlying error: The file “WebDriverAgentRunner-Runner” couldn’t be opened because you don’t have permission to view it. You don’t have permission. (Underlying error: The operation couldn’t be completed. Permission denied)))
[debug] [W3C] ** TEST EXECUTE FAILED **. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
[debug] [W3C]     at quitAndUninstall (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:519:15)
[debug] [W3C]     at /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:549:11
[debug] [W3C]     at wrapped (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:35:13)
[debug] [W3C]     at retry (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:18:13)
[debug] [W3C]     at retryInterval (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:45:10)
[debug] [W3C]     at /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:529:7

appium-doctor --ios

info AppiumDoctor Appium Doctor v.1.13.0
info AppiumDoctor ### Diagnostic for necessary dependencies starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ Node version is 13.6.0
info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor  ✔ Xcode Command Line Tools are installed in: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor  ✔ DevToolsSecurity is enabled.
info AppiumDoctor  ✔ The Authorization DB is set up properly.
info AppiumDoctor  ✔ Carthage was found at: /usr/local/bin/carthage. Installed version is: 0.34.0
info AppiumDoctor  ✔ HOME is set to: /Users/deployer
info AppiumDoctor ### Diagnostic for necessary dependencies completed, no fix needed. ###
info AppiumDoctor 
info AppiumDoctor ### Diagnostic for optional dependencies starting ###
WARN AppiumDoctor  ✖ opencv4nodejs cannot be found.
WARN AppiumDoctor  ✖ ffmpeg cannot be found
WARN AppiumDoctor  ✖ mjpeg-consumer cannot be found.
WARN AppiumDoctor  ✖ set-simulator-location is not installed
info AppiumDoctor  ✔ idb and idb_companion are installed
WARN AppiumDoctor  ✖ applesimutils cannot be found
info AppiumDoctor  ✔ ios-deploy is installed at: /usr/local/bin/ios-deploy. Installed version is: 1.10.0
info AppiumDoctor ### Diagnostic for optional dependencies completed, 5 fixes possible. ###
info AppiumDoctor 
info AppiumDoctor ### Optional Manual Fixes ###
info AppiumDoctor The configuration can install optionally. Please do the following manually:
WARN AppiumDoctor  ➜ Why opencv4nodejs is needed and how to install it: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
WARN AppiumDoctor  ➜ ffmpeg is needed to record screen features. Please read https://www.ffmpeg.org/ to install it
WARN AppiumDoctor  ➜ mjpeg-consumer module is required to use MJPEG-over-HTTP features. Please install it with 'npm i -g mjpeg-consumer'.
WARN AppiumDoctor  ➜ set-simulator-location is needed to set location for Simulator. Please real https://github.com/lyft/set-simulator-location to install it
WARN AppiumDoctor  ➜ Why applesimutils is needed and how to install it: http://appium.io/docs/en/drivers/ios-xcuitest/
info AppiumDoctor 
info AppiumDoctor ###
info AppiumDoctor 
info AppiumDoctor Bye! Run appium-doctor again when all manual fixes have been applied!

I tried:

  • Restart iphone and Mac
  • Uninstall IntegrationApp from Iphone
  • Reinstall appium
  • Delete and create developer certificate
  • Connect another iphone

It gave nothing.
Since it is a matter of may be access issue - I have not used sudo.
I am ready to provide any other data. Thanks

I found a bug on github with the same error:

Could you see if that helps you?

1 Like

Yes, I tried this
/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/ the xcode project on this path I have “configured”.
I also checked my actions according to the latest updates in https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md