Error: Could not find a driver for automationName 'Appium' and platformName 'Android'
Asked Answered
O

3

7

When I try to run my application using nodejs. I get above error into appium server

test.js file

var wd = require("wd");
var appDriver = wd.remote({
    hostname: '127.0.0.1',
    port: 4723,
})

var config = {};

config.android19Hybrid = {
   automationName: 'Appium',
   browserName: '',
   platformName: 'Android',
   platformVersion: 19,// API level integer, or a version string like '4.4.2'
   autoWebview: true,
   deviceName: 'any value; Appium uses the first device from *adb devices*',
   app: "D:\\market-deliveryboy\\platforms\\android\\app\\build\\outputs\\apk\\debug\\app-debug.apk"
};

appDriver.init(config.android19Hybrid);

Error I get on Appium server

[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"automationName":"Appium","browserName":"","platformName":"Android","platformVersion":19,"autoWebview":true,"deviceName":"any value; Appium uses the first device from *adb devices*","app":"D:\\market-deliveryboy\\platforms\\android\\app\\build\\outputs\\apk\\debug\\app-debug.apk"},null,null]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1554729359484 (18:45:59 GMT+0530 (India Standard Time))
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1554729359486 (18:45:59 GMT+0530 (India Standard Time))
[debug] [MJSONWP] Encountered internal error running command: Error: Could not find a driver for automationName 'Appium' and platformName 'Android'. Please check your desired capabilities.
[debug] [MJSONWP]     at AppiumDriver.getDriverAndVersionForCaps (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\lib\appium.js:205:11)
[debug] [MJSONWP]     at AppiumDriver.getDriverAndVersionForCaps [as createSession] (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\lib\appium.js:268:66)
[debug] [MJSONWP]     at AppiumDriver.executeCommand (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:301:19)
[debug] [MJSONWP]     at AppiumDriver.executeCommand (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\lib\appium.js:420:26)
[debug] [MJSONWP]     at executeCommand (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:352:34)
[debug] [MJSONWP]     at asyncHandler (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:489:15)
[debug] [MJSONWP]     at Layer.handle [as handle_request] (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at next (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\route.js:137:13)
[debug] [MJSONWP]     at Route.dispatch (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\route.js:112:3)
[debug] [MJSONWP]     at Layer.handle [as handle_request] (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:281:22
[debug] [MJSONWP]     at Function.process_params (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:335:12)
[debug] [MJSONWP]     at next (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:275:10)
[debug] [MJSONWP]     at logger (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\morgan\index.js:144:5)
[debug] [MJSONWP]     at Layer.handle [as handle_request] (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at trim_prefix (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:317:13)
[debug] [MJSONWP]     at C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:284:7
[debug] [MJSONWP]     at Function.process_params (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:335:12)
[debug] [MJSONWP]     at next (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\express\lib\router\index.js:275:10)
[debug] [MJSONWP]     at C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\body-parser\lib\read.js:130:5
[debug] [MJSONWP]     at invokeCallback (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\raw-body\index.js:224:16)
[debug] [MJSONWP]     at done (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\raw-body\index.js:213:7)
[debug] [MJSONWP]     at IncomingMessage.onEnd (C:\Users\Ravindra.N.Bhanderi\AppData\Roaming\npm\node_modules\appium\node_modules\raw-body\index.js:273:7)
[debug] [MJSONWP]     at IncomingMessage.emit (events.js:182:13)
[debug] [MJSONWP]     at endReadableNT (_stream_readable.js:1086:12)
[debug] [MJSONWP]     at process._tickCallback (internal/process/next_tick.js:63:19)

I try to solve that but not get success. I'm bigger in Ionic + Appium testing. If you have any solution for this then It's very helpful for me.

Thank you in advance

Octopus answered 8/4, 2019 at 13:26 Comment(0)
F
5

Removing this parameter -- automationName: 'Appium', worked for me, as automationName anyway defaults to Appium.

Firecure answered 9/4, 2019 at 2:4 Comment(2)
It makes sense, but after I will try your ANSWER I get another error "Unable to find an active device or emulator with OS 19".Octopus
Does your platformVersion match the OS version on your device/emulator? What happens if you don't provide this parameter?Firecure
D
2

I solved the same problem with installing the uiAutomator2 driver for android. https://appium.io/docs/en/2.0/quickstart/uiauto2-driver/ command - > 'appium driver install uiautomator2'

(If you are using ios device -use this driver appium-xcuitest-driver command - > 'appium driver install xcuitest' )

Depersonalize answered 31/10, 2023 at 5:0 Comment(0)
U
0

I solved this issue in a different way - appium v2.10.3, Appium-Inspector v2024.6.1-win-x64

The parameter automationName flags as mandatory with the above given version combination, so I could not make it work by just removing it. But I was still getting the same error with the following capabilities json -

{
  "platformName": "Android",
  "appium:deviceName": "emulator-5554",
  "appium:appPackage": "com.android.settings",
  "appium:appActivity": ".Settings",
  "appium:automationName": "Appium"
}

I then thought of checking the driver installation once more and used the following command -

appium driver list --verbose

In the response, I noticed that the 'automationName' is actually not "Appium" but "UiAutomator2" - see part of the response below -

√ Listing available drivers (verbose mode)
{
  uiautomator2: {
    pkgName: 'appium-uiautomator2-driver',
    version: '3.5.5',
    installType: 'npm',
    installSpec: 'uiautomator2',
    installPath: '<filepath-redacted>\\.appium\\node_modules\\appium-uiautomator2-driver',
    appiumVersion: '^2.4.1',
    automationName: 'UiAutomator2',
    platformNames: [ 'Android' ],
    mainClass: 'AndroidUiautomator2Driver',
    scripts: { reset: 'scripts/reset.js' },
    doctor: {
      checks: [
        './build/lib/doctor/required-checks.js',
        './build/lib/doctor/optional-checks.js'
      ]
    },
    installed: true
  }

So, simply changing the capabilities json to the following solved this problem for me -

{
  "platformName": "Android",
  "appium:deviceName": "emulator-5554",
  "appium:appPackage": "com.android.settings",
  "appium:appActivity": ".Settings",
  "appium:automationName": "UiAutomator2"
}

Hope this helps!

Uvarovite answered 19/6, 2024 at 17:5 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.