[W3C] Encountered internal error running command: Error: Either JSONWP or W3C capabilities sh

Hi,
Can’t launch appium session, get an errors:

  1. SyntaxError: Cannot use import statement outside a module
  2. Error: Either JSONWP or W3C capabilities should be provided

Can someone help me on how to resolve this?

Appium v1.20.2
appium-xcuitest-driver v3.62
WDA v4.9.0
Node v18.12.1
Java-client v5.0.0-BETA9
MacOS Monterey 12.6.2
Xcode 14.2

Log:
2022-12-27 12:15:54:939 - [HTTP] --> POST /wd/hub/session
2022-12-27 12:15:54:940 - [HTTP] {“desiredCapabilities”:{“noReset”:true,“clearSystemFiles”:true,“useJSONSource”:true,“language”:“en”,“iCloudPassword”:“Qa12345678”,“deviceName”:“Auto126”,“usePrebuiltWDA”:true,“showIOSLog”:false,“iCloudEmail”:“[email protected]”,“showXcodeLog”:true,“newCommandTimeout”:720000,“platformVersion”:“10.0”,“automationName”:“XCUITest”,“wdaStartupRetries”:10,“platformName”:“iOS”,“udid”:“00008101-001508423480001E”,“wdaConnectionTimeout”:“120000”,“app”:"/Users/autoqa/IdeaProjects/automation-framework/Viber_debug.ipa",“preventWDAAttachments”:“true”,“viberUserName”:“Auto126”,“commandTimeouts”:“60000”,“bundleId”:“com.viber.testing”,“derivedDataPath”:"/Users/autoqa/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu",“launchTimeout”:120000,“wdaLocalPort”:8207,“mjpegServerPort”:1002,“largeScreenSize”:false,“machineUser”:“eliaf”,“phoneNumber”:“0611125126”,“wdaStartupRetryInterval”:2000,“location”:“Israel”},“requiredCapabilities”:{}}
2022-12-27 12:15:54:941 - [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“noReset”:true,“clearSystemFiles”:true,“useJSONSource”:true,“language”:“en”,“iCloudPassword”:“Qa12345678”,“deviceName”:“Auto126”,“usePrebuiltWDA”:true,“showIOSLog”:false,“iCloudEmail”:“[email protected]”,“showXcodeLog”:true,“newCommandTimeout”:720000,“platformVersion”:“10.0”,“automationName”:“XCUITest”,“wdaStartupRetries”:10,“platformName”:“iOS”,“udid”:“00008101-001508423480001E”,“wdaConnectionTimeout”:“120000”,“app”:"/Users/autoqa/IdeaProjects/automation-framework/Viber_debug.ipa",“preventWDAAttachments”:“true”,“viberUserName”:“Auto126”,“commandTimeouts”:“60000”,“bundleId”:“com.viber.testing”,“derivedDataPath”:"/Users/autoqa/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu",“launchTimeout”:120000,“wdaLocalPort”:8207,“mjpegServerPort”:1002,“largeScreenSize”:false,“machineUser”:“eliaf”,“phoneNumber”:“0611125126”,“wdaStartupRetryInterval”:2000,“location”:“Israel”},{},null]
2022-12-27 12:15:54:941 - [debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1672136154941 (12:15:54 GMT+0200 (Israel Standard Time))
2022-12-27 12:15:54:945 - [debug] [Appium] /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/index.js:1
2022-12-27 12:15:54:946 - [debug] [Appium] import * as dependencies from ‘./lib/check-dependencies’;
2022-12-27 12:15:54:946 - [debug] [Appium] ^^^^^^
2022-12-27 12:15:54:946 - [debug] [Appium]
2022-12-27 12:15:54:946 - [debug] [Appium] SyntaxError: Cannot use import statement outside a module
2022-12-27 12:15:54:946 - [debug] [Appium] at Object.compileFunction (node:vm:360:18)
2022-12-27 12:15:54:946 - [debug] [Appium] at wrapSafe (node:internal/modules/cjs/loader:1088:15)
2022-12-27 12:15:54:946 - [debug] [Appium] at Module._compile (node:internal/modules/cjs/loader:1123:27)
2022-12-27 12:15:54:947 - [debug] [Appium] at Object.Module._extensions…js (node:internal/modules/cjs/loader:1213:10)
2022-12-27 12:15:54:947 - [debug] [Appium] at Module.load (node:internal/modules/cjs/loader:1037:32)
2022-12-27 12:15:54:947 - [debug] [Appium] at Function.Module._load (node:internal/modules/cjs/loader:878:12)
2022-12-27 12:15:54:947 - [debug] [Appium] at Module.require (node:internal/modules/cjs/loader:1061:19)
2022-12-27 12:15:54:947 - [debug] [Appium] at require (node:internal/modules/cjs/helpers:103:18)
2022-12-27 12:15:54:947 - [debug] [Appium] at Object. (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:5:1)
2022-12-27 12:15:54:947 - [debug] [Appium] at Module._compile (node:internal/modules/cjs/loader:1159:14)
2022-12-27 12:15:54:948 - [debug] [Appium] at Object.Module._extensions…js (node:internal/modules/cjs/loader:1213:10)
2022-12-27 12:15:54:948 - [debug] [Appium] at Module.load (node:internal/modules/cjs/loader:1037:32)
2022-12-27 12:15:54:948 - [debug] [Appium] at Function.Module._load (node:internal/modules/cjs/loader:878:12)
2022-12-27 12:15:54:949 - [debug] [Appium] at Module.require (node:internal/modules/cjs/loader:1061:19)
2022-12-27 12:15:54:949 - [debug] [Appium] at require (node:internal/modules/cjs/helpers:103:18)
2022-12-27 12:15:54:949 - [debug] [Appium] at Object. (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/index.js:4:1)
2022-12-27 12:15:54:951 - [debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1672136154950 (12:15:54 GMT+0200 (Israel Standard Time))
2022-12-27 12:15:54:956 - [debug] [MJSONWP] Encountered internal error running command: Error: Could not load a driver for automationName ‘XCUITest’ and platformName ‘iOS’. Please verify your Appium installation
2022-12-27 12:15:54:956 - [debug] [MJSONWP] at AppiumDriver.getDriverAndVersionForCaps (/usr/local/lib/node_modules/appium/lib/appium.js:252:11)
2022-12-27 12:15:54:957 - [debug] [MJSONWP] at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:324:66)
2022-12-27 12:15:54:957 - [debug] [MJSONWP] at commandExecutor (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:334:9)
2022-12-27 12:15:54:958 - [debug] [MJSONWP] at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:348:15)
2022-12-27 12:15:54:958 - [debug] [MJSONWP] at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/lib/appium.js:533:26)
2022-12-27 12:15:54:958 - [debug] [MJSONWP] at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:297:34)
2022-12-27 12:15:54:958 - [debug] [MJSONWP] at /usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:423:15
2022-12-27 12:15:54:958 - [debug] [MJSONWP] at Layer.handle [as handle_request] (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2022-12-27 12:15:54:958 - [debug] [MJSONWP] at next (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/route.js:144:13)
2022-12-27 12:15:54:958 - [debug] [MJSONWP] at Route.dispatch (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/route.js:114:3)
2022-12-27 12:15:54:959 - [debug] [MJSONWP] at Layer.handle [as handle_request] (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2022-12-27 12:15:54:959 - [debug] [MJSONWP] at /usr/local/lib/node_modules/appium/node_modules/express/lib/router/index.js:284:15
2022-12-27 12:15:54:959 - [debug] [MJSONWP] at Function.process_params (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/index.js:346:12)
2022-12-27 12:15:54:959 - [debug] [MJSONWP] at next (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/index.js:280:10)
2022-12-27 12:15:54:959 - [debug] [MJSONWP] at logger (/usr/local/lib/node_modules/appium/node_modules/morgan/index.js:144:5)
2022-12-27 12:15:54:959 - [debug] [MJSONWP] at Layer.handle [as handle_request] (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2022-12-27 12:15:54:963 - [HTTP] <-- POST /wd/hub/session 500 21 ms - 253
2022-12-27 12:15:54:964 - [HTTP]
2022-12-27 12:15:54:966 - [HTTP] --> POST /wd/hub/session
2022-12-27 12:15:54:967 - [HTTP] {“capabilities”:[{“desiredCapabilities”:{“noReset”:true,“clearSystemFiles”:true,“useJSONSource”:true,“language”:“en”,“iCloudPassword”:“Qa12345678”,“deviceName”:“Auto126”,“usePrebuiltWDA”:true,“showIOSLog”:false,“iCloudEmail”:“[email protected]”,“showXcodeLog”:true,“newCommandTimeout”:720000,“platformVersion”:“10.0”,“automationName”:“XCUITest”,“wdaStartupRetries”:10,“platformName”:“iOS”,“udid”:“00008101-001508423480001E”,“wdaConnectionTimeout”:“120000”,“app”:"/Users/autoqa/IdeaProjects/automation-framework/Viber_debug.ipa",“preventWDAAttachments”:“true”,“viberUserName”:“Auto126”,“commandTimeouts”:“60000”,“bundleId”:“com.viber.testing”,“derivedDataPath”:"/Users/autoqa/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu",“launchTimeout”:120000,“wdaLocalPort”:8207,“mjpegServerPort”:1002,“largeScreenSize”:false,“machineUser”:“eliaf”,“phoneNumber”:“0611125126”,“wdaStartupRetryInterval”:2000,“location”:“Israel”}},{“requiredCapabilities”:{}}]}
2022-12-27 12:15:54:973 - [debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [null,null,[{“desiredCapabilities”:{“noReset”:true,“clearSystemFiles”:true,“useJSONSource”:true,“language”:“en”,“iCloudPassword”:“Qa12345678”,“deviceName”:“Auto126”,“usePrebuiltWDA”:true,“showIOSLog”:false,“iCloudEmail”:“[email protected]”,“showXcodeLog”:true,“newCommandTimeout”:720000,“platformVersion”:“10.0”,“automationName”:“XCUITest”,“wdaStartupRetries”:10,“platformName”:“iOS”,“udid”:“00008101-001508423480001E”,“wdaConnectionTimeout”:“120000”,“app”:"/Users/autoqa/IdeaProjects/automation-framework/Viber_debug.ipa",“preventWDAAttachments”:“true”,“viberUserName”:“Auto126”,“commandTimeouts”:“60000”,“bundleId”:“com.viber.testing”,“derivedDataPath”:"/Users/autoqa/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu",“launchTimeout”:120000,“wdaLocalPort”:8207,“mjpegServerPort”:1002,“largeScreenSize”:false,“machineUser”:“eliaf”,“phoneNumber”:“0611125126”,“wdaStartupRetryInterval”:2000,“location”:“Israel”}},{“requiredCapabilities”:{}}]]
2022-12-27 12:15:54:973 - [debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1672136154973 (12:15:54 GMT+0200 (Israel Standard Time))
2022-12-27 12:15:54:998 - [debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1672136154998 (12:15:54 GMT+0200 (Israel Standard Time))
2022-12-27 12:15:55:001 - [debug] [W3C] Encountered internal error running command: Error: Either JSONWP or W3C capabilities should be provided
2022-12-27 12:15:55:001 - [debug] [W3C] at parseCapsForInnerDriver (/usr/local/lib/node_modules/appium/lib/utils.js:58:14)
2022-12-27 12:15:55:001 - [debug] [W3C] at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:309:26)
2022-12-27 12:15:55:001 - [debug] [W3C] at commandExecutor (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:334:9)
2022-12-27 12:15:55:002 - [debug] [W3C] at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/basedriver/driver.js:348:15)
2022-12-27 12:15:55:002 - [debug] [W3C] at AppiumDriver.executeCommand (/usr/local/lib/node_modules/appium/lib/appium.js:533:26)
2022-12-27 12:15:55:002 - [debug] [W3C] at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:297:34)
2022-12-27 12:15:55:003 - [debug] [W3C] at /usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:423:15
2022-12-27 12:15:55:003 - [debug] [W3C] at Layer.handle [as handle_request] (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2022-12-27 12:15:55:003 - [debug] [W3C] at next (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/route.js:144:13)
2022-12-27 12:15:55:003 - [debug] [W3C] at Route.dispatch (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/route.js:114:3)
2022-12-27 12:15:55:003 - [debug] [W3C] at Layer.handle [as handle_request] (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)
2022-12-27 12:15:55:003 - [debug] [W3C] at /usr/local/lib/node_modules/appium/node_modules/express/lib/router/index.js:284:15
2022-12-27 12:15:55:003 - [debug] [W3C] at Function.process_params (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/index.js:346:12)
2022-12-27 12:15:55:003 - [debug] [W3C] at next (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/index.js:280:10)
2022-12-27 12:15:55:004 - [debug] [W3C] at logger (/usr/local/lib/node_modules/appium/node_modules/morgan/index.js:144:5)
2022-12-27 12:15:55:004 - [debug] [W3C] at Layer.handle [as handle_request] (/usr/local/lib/node_modules/appium/node_modules/express/lib/router/layer.js:95:5)

I have the same Error

Please suggest solution

Use Appium 2 with Xcode 14.

Thank you Very Much Wreed
working on Appium2 now and configured WDA in Xcode as Well and Installed Integration app on real device.
But I got another Error now with appium 2
Please i need Your help with this…

log file
:heavy_check_mark: Checking if driver ‘xcuitest’ is updatable
:heavy_multiplication_x: Checking if driver ‘xcuitest’ needs an update
:heavy_check_mark: Checking if driver ‘uiautomator2’ is updatable
:heavy_multiplication_x: Checking if driver ‘uiautomator2’ needs an update
:information_source: Update report:
:information_source: - ‘xcuitest’ had no updates available
:information_source: - ‘uiautomator2’ had no updates available

-MacBook-Pro ~ % appium
[Appium] Welcome to Appium v2.0.0-beta.48
[Appium] Attempting to load driver xcuitest…
[debug] [Appium] Requiring driver at /Users/findia12/.appium/node_modules/appium-xcuitest-driver
[Appium] Could not load driver ‘xcuitest’, so it will not be available. Error in loading the driver was: Cannot find module ‘./capabilities’

Screenshot 2023-01-03 at 12.31.42 PM

You haven’t given enough information. This looks like some kind of GUI error. Maybe try to ask a better question:

https://stackoverflow.com/help/how-to-ask

Thank You @wreed , Appium is working fine now.