Unable to launch appium configuration on iphone from Xcode - selenium-webdriver

We are trying to launch a WebDriverAgent and its getting stuck at the following step (Extract of log):
[MJSONWP] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'security -v unlock-keychain -p exited with code 49
The app is getting installed on the phone.The error is only while attempting to launch from Xcode and works fine when run directly from the phone.
Code:
public void setup() throws MalformedURLException, InterruptedException { System.out.println("====Setting capabilities===="); DesiredCapabilities cap = new DesiredCapabilities(); // cap.setCapability("appium-version", "1.6.4"); cap.setCapability("platformVersion", "10.3"); // cap.setCapability("deviceName", "iPhone 6"); cap.setCapability("deviceName", "astha’s iPhone"); cap.setCapability("platformName", "iOS"); cap.setCapability("automationName", "XCUITest"); cap.setCapability("showXcodeLog", "true"); cap.setCapability("udid", "86c8805d20315df3c4f707e25ee4327a12106260"); //cap.setCapability("desiredCapabilities", "optional"); // cap.setCapability("udid","80072f1273b0ac59431f70934d9d5eec38de8a3a");
cap.setCapability("keychainPath", "/Users/atulmhetre/Documents/Certificates.p12"); //cap.setCapability("keychainPath", "/Users/atulmhetre/Library/Keychains/MyKeychain.keychain");
cap.setCapability("keychainPassword", "<password>"); /// Users/atulmhetre/Library/Keychains/ //// Users/atulmhetre/Documents/MyPrivateKey.p12 File app = new File("/Users/atulmhetre/Desktop/Sample Application/UiKitCatalog.app"); cap.setCapability("app",
"/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app"); // cap.setCapability("app","/Users/atulmhetre/Library/Developer/Xcode/DerivedData/UIKitCatalog-akevtpkxonmoyogdvhqvrqlkacji/Build/Products/Debug-iphoneos/UIKitCatalog.app");
cap.setCapability("bundleId", "com.nihilent.IntegrationApp"); // cap.setCapability("bundleId","com.example.nihilent.UIKitCatalogMob");
cap.setCapability("noReset", true); System.out.println("====after setting===="); driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), cap); driver.findElementByName("Alerts").click();
Appium Logs:
[Appium] Welcome to Appium v1.6.4 [Appium] Non-default server args: [Appium] address: 127.0.0.1 [Appium] Appium REST http interface listener started on 127.0.0.1:4723 [HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app","showXcodeLog":"true","noReset":true,"platformVersion":"10.3","automationName":"XCUITest","keychainPath":"/Users/atulmhetre/Documents/Certificates.p12","bundleId":"com.nihilent.IntegrationApp","keychainPassword":"republic123","platformName":"iOS","udid":"86c8805d20315df3c4f707e25ee4327a12106260","deviceName":"astha’s iPhone"},"requiredCapabilities":{},"capabilities":{"desiredCapabilities":{"app":"/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app","showXcodeLog":"true","noReset":true,"platformVersion":"10.3","automationName":"XCUITest","keychainPath":"/Users/atulmhetre/Documents/Certificates.p12","bundleId":"com.nihilent.IntegrationApp","keychainPassword":"republic123","platformName":"iOS","udid":"86c8805d20315df3c4 [MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app","showXcodeLog":"true","noReset":true,"platformVersion":"10.3","automationName":"XCUITest","keychainPath":"/Users/atulmhetre/Documents/Certificates.p12","bundleId":"com.nihilent.IntegrationApp","keychainPassword":"republic123","platformName":"iOS","udid":"86c8805d20315df3c4f707e25ee4327a12106260","deviceName":"astha’s iPhone"},{},{"desiredCapabilities":{"app":"/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app","showXcodeLog":"true","noReset":true,"platformVersion":"10.3","automationName":"XCUITest","keychainPath":"/Users/atulmhetre/Documents/Certificates.p12","bundleId":"com.nihilent.IntegrationApp","keychainPassword":"republic123","platformName":"iOS","udid":"86c8805d20315df3c4f707e25ee4327a12106260","deviceName":"astha’s iPhone"},"requiredCapabilities":{},... [BaseDriver] Event 'newSessionRequested' logged at 1494757197935 (15:49:57 GMT+0530 (IST)) [Appium] Creating new XCUITestDriver (v2.27.2) session [Appium] Capabilities: [Appium] app: '/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app' [Appium] showXcodeLog: 'true' [Appium] noReset: true [Appium] platformVersion: '10.3' [Appium] automationName: 'XCUITest' [Appium] keychainPath: '/Users/atulmhetre/Documents/Certificates.p12' [Appium] bundleId: 'com.nihilent.IntegrationApp' [Appium] keychainPassword: 'republic123' [Appium] platformName: 'iOS' [Appium] udid: '86c8805d20315df3c4f707e25ee4327a12106260' [Appium] deviceName: 'astha’s iPhone' [XCUITest] XCUITestDriver version: 2.27.2 [BaseDriver] Capability 'showXcodeLog' changed from string to boolean. This may cause unexpected behavior [BaseDriver] Session created with session id: 8ffef180-184b-436c-8648-e4af5805b9d4 [XCUITest] Xcode version set to '8.3.2' (tools v8.1.0.0.1.1476494586) [XCUITest] iOS SDK Version set to '10.3' [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1494757198121 (15:49:58 GMT+0530 (IST)) [XCUITest] Available devices: 86c8805d20315df3c4f707e25ee4327a12106260 [XCUITest] Creating iDevice object with udid '86c8805d20315df3c4f707e25ee4327a12106260' [XCUITest] Determining device to run tests on: udid: '86c8805d20315df3c4f707e25ee4327a12106260', real device: true [BaseDriver] Using local app '/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app' [BaseDriver] Event 'appConfigured' logged at 1494757198383 (15:49:58 GMT+0530 (IST)) [XCUITest] Checking whether app '/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app' is actually present on file system [XCUITest] App is present [BaseDriver] Event 'resetStarted' logged at 1494757198385 (15:49:58 GMT+0530 (IST)) [XCUITest] Reset: fullReset not set. Leaving as is [BaseDriver] Event 'resetComplete' logged at 1494757198386 (15:49:58 GMT+0530 (IST)) [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog [iOSLog] Found idevicesyslog: '/usr/local/bin/idevicesyslog' [BaseDriver] Event 'logCaptureStarted' logged at 1494757198552 (15:49:58 GMT+0530 (IST)) [XCUITest] Setting up real device [XCUITest] Installing '/Users/atulmhetre/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/IntegrationApp.app' on device with UUID '86c8805d20315df3c4f707e25ee4327a12106260'... [XCUITest] The app has been installed successfully. [BaseDriver] Event 'appInstalled' logged at 1494757201209 (15:50:01 GMT+0530 (IST)) [BaseDriver] Event 'wdaStartAttempted' logged at 1494757201211 (15:50:01 GMT+0530 (IST)) [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] Launching WebDriverAgent on the device [XCUITest] Carthage found: '/usr/local/bin/carthage' [XCUITest] Killing hanging processes [XCUITest] Setting security for iOS device [BaseDriver] Event 'wdaStartFailed' logged at 1494757201483 (15:50:01 GMT+0530 (IST))
[XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: Command 'security -v unlock-keychain -p republic123 /Users/atulmhetre/Documents/Certificates.p12' exited with code 49 [XCUITest] Quitting and uninstalling WebDriverAgent, then retrying [XCUITest] Shutting down sub-processes [XCUITest] Removing WDA application from device [BaseDriver] Event 'wdaStartAttempted' logged at 1494757211928 (15:50:11 GMT+0530 (IST)) [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] Launching WebDriverAgent on the device [XCUITest] Carthage found: '/usr/local/bin/carthage' [XCUITest] Killing hanging processes [XCUITest] Setting security for iOS device [BaseDriver] Event 'wdaStartFailed' logged at 1494757212093 (15:50:12 GMT+0530 (IST))
[XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: Command 'security -v unlock-keychain -p republic123 /Users/atulmhetre/Documents/Certificates.p12' exited with code 49 [XCUITest] Quitting and uninstalling WebDriverAgent, then retrying [XCUITest] Shutting down sub-processes [XCUITest] Removing WDA application from device [XCUITest] Error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'security -v unlock-keychain -p republic123 /Users/atulmhetre/Documents/Certificates.p12' exited with code 49
at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:374:15)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7) Error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'security -v unlock-keychain -p republic123 /Users/atulmhetre/Documents/Certificates.p12' exited with code 49
at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:374:15)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7) [XCUITest] Not clearing log files. Use clearSystemFiles capability to turn on. [iOSLog] Stopping iOS log capture [MJSONWP] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'security -v unlock-keychain -p republic123 /Users/atulmhetre/Documents/Certificates.p12' exited with code 49
at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:374:15)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7) [HTTP] <-- POST /wd/hub/session 500 24471 ms - 317
Appreciate your responses in advance.

Related

Appium (and desktop) unable to launch wda session since xCode13 and iOS15

Since my xCode got (automatically...) updated to 13 and all my simulators moved from iOS 14.5 to 15. with the same setup / commands I'm unable to launch the WDA from both the desktop app, and the node ( selenium server grid/node setup)
The issue exists for all simulators.
I can still use real device..
(the actual ports in errors might differ, the first one is from the actual automation where it fails, the 2nd and 3rd is from the desktop app -where it still fails with the same error. the root issue is still the same on both)
The error logs I get:
In short:
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8205
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Janoss-MacBook-Pro.local', ip: 'fe80:0:0:0:18e4:52:307c:8c7b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.5', java.version: '11.0.11'
Driver info: driver.version: IOSDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8205
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:380:37)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Janoss-MacBook-Pro.local', ip: 'fe80:0:0:0:18e4:52:307c:8c7b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.5', java.version: '11.0.11'
Driver info: driver.version: IOSDriver
The longer error from the server:
[iOSSim] Got Simulator UI client PID: 11815
[iOSSim] Both Simulator with UDID 'F5A500AB-FAA5-41A0-A009-E5A8EDB8643A' and the UI client are currently running
[BaseDriver] Event 'simStarted' logged at 1632487969688 (14:52:49 GMT+0200 (Central European Summer Time))
[WebDriverAgent] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[DevCon Factory] Requesting connection for device F5A500AB-FAA5-41A0-A009-E5A8EDB8643A on local port 8100
[DevCon Factory] Cached connections count: 0
[DevCon Factory] Successfully requested the connection for F5A500AB-FAA5-41A0-A009-E5A8EDB8643A:8100
[XCUITest] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[WebDriverAgent] WDA is not listening at 'http://127.0.0.1:8100/'
[WebDriverAgent] WDA is currently not running. There is nothing to cache
[XCUITest] Trying to start WebDriverAgent 2 times with 10000ms interval
[XCUITest] These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[BaseDriver] Event 'wdaStartAttempted' logged at 1632487969773 (14:52:49 GMT+0200 (Central European Summer Time))
[WebDriverAgent] Launching WebDriverAgent on the device
[WebDriverAgent] WebDriverAgent does not need a cleanup. The sources are up to date (1620631774000 >= 1620631774000)
[WebDriverAgent] Killing running processes 'xcodebuild.*F5A500AB-FAA5-41A0-A009-E5A8EDB8643A, F5A500AB-FAA5-41A0-A009-E5A8EDB8643A.*XCTRunner, xctest.*F5A500AB-FAA5-41A0-A009-E5A8EDB8643A' for the device F5A500AB-FAA5-41A0-A009-E5A8EDB8643A...
[WebDriverAgent] 'pgrep -if xcodebuild.*F5A500AB-FAA5-41A0-A009-E5A8EDB8643A' didn't detect any matching processes. Return code: 1
[WebDriverAgent] 'pgrep -if F5A500AB-FAA5-41A0-A009-E5A8EDB8643A.*XCTRunner' didn't detect any matching processes. Return code: 1
[WebDriverAgent] 'pgrep -if xctest.*F5A500AB-FAA5-41A0-A009-E5A8EDB8643A' didn't detect any matching processes. Return code: 1
[WebDriverAgent] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=F5A500AB-FAA5-41A0-A009-E5A8EDB8643A IPHONEOS_DEPLOYMENT_TARGET=15.0 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent'
[WebDriverAgent] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability
[WebDriverAgent] Waiting up to 60000ms for WebDriverAgent to start
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
Then a long waiting with only the ECONNREFUSED error and finally failing:
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[XCUITest] Failed to create WDA session (An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100). Retrying...
[XCUITest] UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[XCUITest] at JWProxy.command (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:274:13)
[XCUITest] at runMicrotasks ()
[XCUITest] at processTicksAndRejections (internal/process/task_queues.js:85:5)
[XCUITest] Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[XCUITest] Quitting and uninstalling WebDriverAgent
[WebDriverAgent] Shutting down sub-processes
[iOSSim] Building bundle path map
[iOSSim] The simulator has '1' bundles which have 'WebDriverAgentRunner-Runner' as their 'CFBundleName':
[iOSSim] 'com.jano.facebook.WebDriverAgentRunner.xctrunner'
[WebDriverAgent] Uninstalling WDAs: 'com.jano.facebook.WebDriverAgentRunner.xctrunner'
[XCUITest] {}
[DevCon Factory] Releasing connections for F5A500AB-FAA5-41A0-A009-E5A8EDB8643A device on any port number
[DevCon Factory] Found cached connections to release: ["F5A500AB-FAA5-41A0-A009-E5A8EDB8643A:8100"]
[DevCon Factory] Cached connections count: 0
[XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[IOSSimulatorLog] Stopping iOS log capture
[BaseDriver] Event 'newSessionStarted' logged at 1632488146662 (14:55:46 GMT+0200 (Central European Summer Time))
[MJSONWP] Encountered internal error running command: Error: Unable to start WebDriverAgent session because of xcodebuild failure: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8100
[MJSONWP] at quitAndUninstall (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:544:15)
[MJSONWP] at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:610:11
[MJSONWP] at wrapped (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:60:13)
[MJSONWP] at retry (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:43:13)
[MJSONWP] at retryInterval (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:70:10)
[MJSONWP] at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:559:7
[HTTP] <-- POST /wd/hub/session 500 177858 ms - 388
[HTTP]
[HTTP] --> DELETE /wd/hub/session
To solve this issue,
We need to update our appkum on the computer ( should be 1.22.0 or above)
To see your version:
appium -v
To install / Update your appium:
npm install -g appium
This fixed the simulator part. to fix the appium desktop, you also have to update the desktop app, but now it's moved on as 2 separate app.
One for the server
https://github.com/appium/appium-desktop/releases/
And one for the inspector https://github.com/appium/appium-inspector/releases
I had a similar problem with the old appium (where the server and the inspector were combined), and with the new version, where they were taken out separately.
I solved it by adding server Capabilities:
serverCapabilities.setCapability("wdaStartupRetries", "4");
serverCapabilities.setCapability("iosInstallPause","8000" );
serverCapabilities.setCapability("wdaStartupRetryInterval", "20000");
after that, the wda session became stable
I had the same problem
I solved it by adding appium desired capabilities and I reduced the time from 120 to 60 for newCommandTimeout capabilities
my appium capabilities' last status
"newCommandTimeout": 60,
"wdaStartupRetries": 3,
"wdaStartupRetryInterval": 20000

Unable to start appium server programmatically. Error: spawn ENOTDIR

I am trying to launch appium server using 'AppiumServiceBuilder' in mac. I am referring the following website:
https://appiumpro.com/editions/71
I am using the following code:
AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();
serviceBuilder.usingAnyFreePort();
serviceBuilder.usingDriverExecutable(new File("/usr/local/bin/node"));
serviceBuilder.withAppiumJS(new File("/usr/local/bin/appium"));
HashMap<String, String> environment = new HashMap();
environment.put("PATH", "/usr/local/bin/carthage");
serviceBuilder.withEnvironment(environment);
server = AppiumDriverLocalService.buildService(TLDriverFactory.serviceBuilder);
server.start();
while starting the appium am using this:
capabilities.setCapability("automationName", "XCUITest");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion","12.3.1");
capabilities.setCapability("deviceName", "iPhone 6");
capabilities.setCapability("udid", getDeviceID());
capabilities.setCapability("bundleId", getBundleId());
capabilities.setCapability("noReset", true);
capabilities.setCapability("waitForQuiescence", false);
capabilities.setCapability("useJSONSource", true);
iDriver = new IOSDriver<IOSElement>(server.getUrl(),capabilities);
This is the console message am getting during the iDriver initialization:
[35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session[39m
[35m[HTTP][39m [90m{"desiredCapabilities":{"waitForQuiescence":false,"noReset":true,"useJSONSource":true,"platformVersion":"12.3.1","automationName":"XCUITest","bundleId":"com.tekion.cdmsmobileenterprise","platformName":"iOS","udid":"cc6080c50dad4605d8e5511e89410792f0100026","deviceName":"iPhone 6"},"capabilities":{"alwaysMatch":{"appium:automationName":"XCUITest","appium:bundleId":"com.tekion.cdmsmobileenterprise","appium:deviceName":"iPhone 6","appium:noReset":true,"platformName":"ios","appium:platformVersion":"12.3.1","appium:udid":"cc6080c50dad4605d8e5511e89410792f0100026","useJSONSource":true,"waitForQuiescence":false},"firstMatch":[{}]}}[39m
[debug] [35m[W3C][39m Calling AppiumDriver.createSession() with args: [{"waitForQuiescence":false,"noReset":true,"useJSONSource":true,"platformVersion":"12.3.1","automationName":"XCUITest","bundleId":"com.tekion.cdmsmobileenterprise","platformName":"iOS","udid":"cc6080c50dad4605d8e5511e89410792f0100026","deviceName":"iPhone 6"},null,{"alwaysMatch":{"appium:automationName":"XCUITest","appium:bundleId":"com.tekion.cdmsmobileenterprise","appium:deviceName":"iPhone 6","appium:noReset":true,"platformName":"ios","appium:platformVersion":"12.3.1","appium:udid":"cc6080c50dad4605d8e5511e89410792f0100026","useJSONSource":true,"waitForQuiescence":false},"firstMatch":[{}]}]
[debug] [35m[BaseDriver][39m Event 'newSessionRequested' logged at 1568395822117 (23:00:22 GMT+0530 (India Standard Time))
[35m[BaseDriver][39m The capabilities ["useJSONSource","waitForQuiescence"] are not standard capabilities and should have an extension prefix
[35m[Appium][39m Appium v1.13.0 creating new XCUITestDriver (v2.113.2) session
[35m[Appium][39m Capabilities:
[35m[Appium][39m platformName: ios
[35m[Appium][39m useJSONSource: true
[35m[Appium][39m waitForQuiescence: false
[35m[Appium][39m automationName: XCUITest
[35m[Appium][39m bundleId: com.tekion.cdmsmobileenterprise
[35m[Appium][39m deviceName: iPhone 6
[35m[Appium][39m noReset: true
[35m[Appium][39m platformVersion: 12.3.1
[35m[Appium][39m udid: cc6080c50dad4605d8e5511e89410792f0100026
[debug] [35m[BaseDriver][39m W3C capabilities {"alwaysMatch":{"platformNa... and MJSONWP desired capabilities {"waitForQuiescence":false,... were provided
[debug] [35m[BaseDriver][39m Creating session with W3C capabilities: {"alwaysMatch":{"platformNa...
[35m[BaseDriver][39m Session created with session id: 7e5f96b0-2540-41d4-9d2f-4153ffef9cd3
[debug] [35m[XCUITest][39m Unable to get username running server: spawn ENOTDIR
[35m[XCUITest][39m Error: spawn ENOTDIR
[35m[XCUITest][39m at ChildProcess.spawn (internal/child_process.js:394:11)
[35m[XCUITest][39m at spawn (child_process.js:540:9)
[35m[XCUITest][39m at /usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:30:16
[35m[XCUITest][39m at Promise.cancellationExecute [as _execute] (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/debuggability.js:335:9)
[35m[XCUITest][39m at Promise._resolveFromExecutor (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/promise.js:483:18)
[35m[XCUITest][39m at new Promise (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/promise.js:79:10)
[35m[XCUITest][39m at exec (/usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:27:10)
[35m[XCUITest][39m at getConnectedDevices (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/real-device-management.js:8:26)
[35m[XCUITest][39m at XCUITestDriver.determineDevice (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:762:31)
[35m[XCUITest][39m at XCUITestDriver.determineDevice [as start] (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:269:51)
[35m[XCUITest][39m at runNextTicks (internal/process/task_queues.js:58:5)
[35m[XCUITest][39m at processImmediate (internal/timers.js:412:9)
[35m[XCUITest][39m at XCUITestDriver.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:206:7)
[35m[XCUITest][39m at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:342:35)
[35m[XCUITest][39m at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:319:13)
[35m[XCUITest][39m at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/lib/appium.js:471:14)
[35m[XCUITest][39m at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:352:21)
[debug] [35m[BaseDriver][39m Event 'newSessionStarted' logged at 1568395822141 (23:00:22 GMT+0530 (India Standard Time))
[debug] [35m[W3C][39m Encountered internal error running command: Error: spawn ENOTDIR
[debug] [35m[W3C][39m at ChildProcess.spawn (internal/child_process.js:394:11)
[debug] [35m[W3C][39m at spawn (child_process.js:540:9)
[debug] [35m[W3C][39m at /usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:30:16
[debug] [35m[W3C][39m at Promise.cancellationExecute [as _execute] (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/debuggability.js:335:9)
[debug] [35m[W3C][39m at Promise._resolveFromExecutor (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/promise.js:483:18)
[debug] [35m[W3C][39m at new Promise (/usr/local/lib/node_modules/appium/node_modules/bluebird/js/release/promise.js:79:10)
[debug] [35m[W3C][39m at exec (/usr/local/lib/node_modules/appium/node_modules/teen_process/lib/exec.js:27:10)
[debug] [35m[W3C][39m at getConnectedDevices (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/real-device-management.js:8:26)
[debug] [35m[W3C][39m at XCUITestDriver.determineDevice (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:762:31)
[debug] [35m[W3C][39m at XCUITestDriver.determineDevice [as start] (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:269:51)
[debug] [35m[W3C][39m at runNextTicks (internal/process/task_queues.js:58:5)
[debug] [35m[W3C][39m at processImmediate (internal/timers.js:412:9)
[debug] [35m[W3C][39m at XCUITestDriver.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:206:7)
[debug] [35m[W3C][39m at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:342:35)
[debug] [35m[W3C][39m at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:319:13)
[debug] [35m[W3C][39m at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/lib/appium.js:471:14)
[debug] [35m[W3C][39m at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:352:21)
[35m[HTTP][39m [37m<-- POST /wd/hub/session [39m[31m500[39m [90m28 ms - 523[39m
[35m[HTTP][39m [90m[39m
org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Abduls-MacBook-Pro-2.local', ip: '2402:3a80:464:2a24:6980:fa71:954a:5c2b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '12'
Driver info: driver.version: IOSDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94)
at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:95)
at com.utilities.TLDriverFactory.initializeIOSDriver(TLDriverFactory.java:225)
at com.utilities.TLDriverFactory.setTLDriver(TLDriverFactory.java:134)
at com.utilities.Tek_Properties.beforeMethodReporting(Tek_Properties.java:257)
at com.utilities.Mobile_TestBase.initializWebDriver(Mobile_TestBase.java:162)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:185)
... 44 more
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: spawn ENOTDIR
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Abduls-MacBook-Pro-2.local', ip: '2402:3a80:464:2a24:6980:fa71:954a:5c2b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '12'
Driver info: driver.version: IOSDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: spawn ENOTDIR
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:447:37)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
... 49 more
I googled and found that the spawn : enotdir is due to missing phantomJS. I did it:
brew cask install phantomjs
node rebuild
I am still getting the issue.
I have two questions:
1. How to resolve this issue and make it work?
2. While launching iDriver, why it says 'The capabilities ["useJSONSource","waitForQuiescence"] are not standard capabilities and should have an extension prefix'? Does that mean these capabilities won't work if appium is launched via AppiumServiceBuilder?
Mac version: macOS Mojave 10.14.6
Appium Version: 1.13.0
Appium Java Client: 6.1.0 (Tried with 7.2.0 as well)
Selenium Version: 3.4.0
I tried with this code:
AppiumServiceBuilder serviceBuilder = new AppiumServiceBuilder();
serviceBuilder.usingAnyFreePort();
serviceBuilder.usingDriverExecutable(new File("/usr/local/bin/node"));
serviceBuilder.withAppiumJS(new File("/usr/local/bin/appium"));
HashMap<String, String> environment = new HashMap();
environment.put("PATH", "/usr/local/bin:" + System.getenv("PATH"));
serviceBuilder.withEnvironment(environment);
server.set(AppiumDriverLocalService.buildService(serviceBuilder));
server.get().start();
This worked fine for me.

NoSuchWindowError: Browsing context has been discarded with GeckoDriver Firefox and Protractor(Selenium)

I'm trying to run a simple test script using protractor.
Environment:
Node Version: v9.8.0
Protractor Version: 5.4.1
Angular Version: 1.x
Browser(s): Mozilla Firefox 60.1.0
Operating System and Version: HELiOS release 6.10
Here's my protractor config file.
exports.config = {
specs: ['todo-spec.js'],
capabilities: {
browserName: 'firefox',
marionette : true
}
};
This is my test script (todo-spec.js)
describe('application homepage', function() {
it('should open homepage', function() {
console.log("Opening localhost app");
browser.get('http://localhost:8080/app/');
browser.sleep(20000); // just to check if application loaded or not
});
});
This is my node_modules/protractor/node_modules/webdriver-manager/selenium/ directory looks like:
When I run my test using /path/to/protractor conf.js, I'm getting below mentioned error.
[16:51:03] I/launcher - Running 1 instances of WebDriver
[16:51:03] I/local - Starting selenium standalone server...
[16:51:04] I/local - Selenium standalone server started at http://<ip-address>:45089/wd/hub
Started
Opening localhost
F
Failures:
1) application homepage should open homepage
Message:
Failed: Browsing context has been discarded
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'HOSTNAME', ip: 'ip_address', os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-754.3.5.el6.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
Stack:
NoSuchWindowError: Browsing context has been discarded
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
System info: host: 'HOSTNAME', ip: 'ip_address', os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-754.3.5.el6.x86_64', java.version: '1.8.0_181'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
From: Task: Protractor.get(http://localhost:8080/app/) - reset url
at thenableWebDriverProxy.schedule (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at ProtractorBrowser.executeScriptWithDescription (/export/home/test/protractor_test_2/node_modules/protractor/built/browser.js:404:28)
at driver.controlFlow.execute.then.then.then (/export/home/test/protractor_test_2/node_modules/protractor/built/browser.js:679:25)
at ManagedPromise.invokeCallback_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:1376:14)
at TaskQueue.execute_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:3084:14)
at TaskQueue.executeNext_ (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:3067:27)
at asyncRun (/export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:2927:27)
at /export/home/test/protractor_test_2/node_modules/selenium-webdriver/lib/promise.js:668:7
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
From: Task: Run it("should open homepage") in control flow
at UserContext.<anonymous> (/export/home/test/protractor_test_2/node_modules/jasminewd2/index.js:94:19)
From asynchronous test:
Error
at Suite.<anonymous> (/export/home/test/protractor_test_2/todo-spec.js:2:3)
at Object.<anonymous> (/export/home/test/protractor_test_2/todo-spec.js:1:63)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
1 spec, 1 failure
Finished in 0.159 seconds
[16:51:06] I/local - Shutting down selenium standalone server.
[16:51:06] I/launcher - 0 instance(s) of WebDriver still running
[16:51:06] I/launcher - firefox #01 failed 1 test(s)
[16:51:06] I/launcher - overall: 1 failed spec(s)
[16:51:06] E/launcher - Process exited with error code 1
Any help would be appreciated.
This error message...
Failed: Browsing context has been discarded
...implies that the communication between GeckoDriver and Marionette was broken.
Some more information regarding the GeckoDriver binary version would have given us some clues about whats wrong happening. However this issue can happen due to multiple factors as follows:
As per Hang when navigation request removes the current browsing context if you have used driver.navigate().back(); when Selenium's focus was within an <iframe> this error is observed.
As per Crash during command execution results in "Internal Server Error: Failed to decode response from marionette" this issue can also occur due to ctypes checks for NULL pointer derefs.
You can find the Selenium testcase here. Perhaps instead of panicking, it would have been better to handle this more gracefully by clearing any state and returning geckodriver to accept new connections again.
As per Failed to decode response from marionette - Error to open Webdriver using python this issue can also occur if you are not using the complient version of the binaries.
This usecase
The root cause of this issue seems to be MemoryUsage. As per Intermittent awsy\test_memory_usage.py TestMemoryUsage.test_open_tabs | NoSuchWindowException: Browsing context has been discarded which is intermittent in nature. This issue was once marked as RESOLVED then again REOPENED.
As #Madhan mentioned while working with AngularJS applications and Protractor always include:
waitForAngularEnabled(true);
Finally, as per best practices while working with GeckoDriver, Selenium and Firefox Browser follow the below compatibility chart:
Supported platforms
Was able to fix this issue with below configuration.
- Protractor: v5.4.1
- Selenium JAR driver: selenium-server-standalone-3.141.59.jar
- geckodriver:geckodriver-v0.20.0-linux64
Also we need to give path of geckodrvier in protractor conf file.
geckoDriver: 'node_modules/protractor/node_modules/webdriver-manager/selenium/geckodriver-v0.20.0'
By default webdriver-manager will download latest version of geckodriver which is 0.24.0. But the needed geckdriver is v0.20.0, so I downloaded this manually and placed it inside node_modules/protractor/node_modules/webdriver-manager/selenium/ directory.
Hope this helps to people facing similar issue.

Appium - Unable to launch WebDriverAgent because of xcodebuild failure: Scripts/bootstrap.sh code 1

I am using webdriver.IO together with Appium to test an iOS hybrid App.
I get the following error before each test when it tries to spin up the iOS App:
Unable to launch WebDriverAgent because of xcodebuild failure: "Command 'Scripts/bootstrap.sh -d' exited with code 1"."
Here are the logs:
[debug] [XCUITest] The app has been installed successfully.
[debug] [BaseDriver] Event 'appInstalled' logged at 1545635044697 (02:04:04 GMT-0500 (Eastern Standard Time))
[XCUITest] Using WDA path: '/Users/MY_USER_NAME/Documents/CODE/ACTIVE/APPIUM/asialgearoid/mine2/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Using WDA agent: '/Users/MY_USER_NAME/Documents/CODE/ACTIVE/APPIUM/asialgearoid/mine2/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
[debug] [XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[debug] [JSONWP Proxy] Matched '/status' to command name 'getStatus'
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[JSONWP Proxy] Got an unexpected response: {"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8100}
[debug] [XCUITest] WDA is not listening at 'http://localhost:8100/'
[debug] [XCUITest] WDA is currently not running. There is nothing to cache
[debug] [XCUITest] Trying to start WebDriverAgent 2 times with 10000ms interval
[debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1545635044905 (02:04:04 GMT-0500 (Eastern Standard Time))
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: '/Users/MY_USER_NAME/Documents/CODE/ACTIVE/APPIUM/asialgearoid/mine2/node_modules/.bin/carthage'
[debug] [XCUITest] Running WebDriverAgent bootstrap script to install dependencies
[XCUITest] [1mFetching dependencies
[XCUITest] Error: Command "bootstrap" does not exist.
...
[debug] [BaseDriver] Event 'wdaStartFailed' logged at 1545635057640 (02:04:17 GMT-0500 (Eastern Standard Time))
[debug] [XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: "Command 'Scripts/bootstrap.sh -d' exited with code 1".
Any idea of how to solve?
After further digging I found out how to reproduce the error:
$ cd /myTestingProject/node_modules/appium-xcuitest-driver/WebDriverAgent
$ ./Scripts/bootstrap.sh
Output:
Fetching dependencies
Error: Command "bootstrap" does not exist.
I do not know if this was your problem at the time of writing, but I had this same issue and looked up the latest update documentation. The file bootstrap.sh has been changed to build.sh
This works for me:
cd /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
./Scripts/build.sh -d
I tested by wiping my simulator so I could test this with a completely clean slate. I ran the above commands, relaunched the simulator, dropped a .app file onto the simulator, and the WebDriverAgent installed completely fine without any manual work opening Xcode.

Getting "Error: read ECONNRESET" on reseting and launching the app

I am getting the following error on resetting the app [driver.resetApp()] and on launching the app on Appium (version: 1.4.16.1). I am using Java.
Eclispe console
org.openqa.selenium.WebDriverException: chrome not reachable
(Session info: chrome=50.0.2661.86)
(Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.08 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'IN2084073W1', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_21'
*** Element info: {Using=id, value=password}
Session ID: 2968b7e9-948e-4b75-94ed-838d10a08c82
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{platform=LINUX, app=C:/apk/appname.apk, javascriptEnabled=true, appActivity=.MainActivity, browserName=, networkConnectionEnabled=true, desired={newCommandTimeout=120, app=C:/apk/surveyorapp.apk, platformVersion=5.1, deviceName=TA93303Q2F, platformName=Android, appActivity=.MainActivity, browserName=, appPackage=com.axa.surveyorapp}, locationContextEnabled=false, appPackage=com.axa.surveyorapp, newCommandTimeout=120, platformVersion=5.1, databaseEnabled=false, deviceName=TA93303Q2F, platformName=Android, webStorageEnabled=false, warnings={}, takesScreenshot=true}]
Appium Log
error: Could not proxy command to remote server. Original error: Error: read ECONNRESET
error: Chromedriver: Chromedriver exited unexpectedly with code 3221225477, signal null
info: Chromedriver: Changed state to 'stopped'
warn: Chromedriver for context WEBVIEW_com.clientname.appname stopped unexpectedly
error: Chromedriver quit unexpectedly during session
Update
Thanks for the update Emna. I have tried your option.
Can you please let me know how exactly I need to add this. I am using AndroidDriver not AppiumDriver. I have tried with both, but I'm getting below error.
Try to use :
(AppiumDriver)driver.resetApp();
Instead of :
driver.resetApp();
You can have a look into this link: Appium java-client
and use this link also to download ;)

Resources