Search code examples
automated-testsappiumui-automationsaucelabs

how to resolve Appium bad parameters error


I am stuck at the error when the appium server shows error

[MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","capabilities","sessionId","id"]} and you sent ["desiredCapabilities","requiredCapabilities","capabilities","alwaysMatch","firstMatch"]

In the eclipse it shows error

org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{app=C:\Users\Admin\workspace\Sling_App\src\app-dev-debug.apk}], required capabilities = Capabilities [{}]

I have been using 5.0.0 and also 4.1.2 client jar

Tried with Selenium 3 , 3.3

Appium Server I tried on are 1.6.2 , 1.6.3 and latest 1.6.4

Nothing Solves the problem , I read most of the articles related to this , but of no use Please tell if any 1 has found solution to thisenter image description here


Solution

  • In ideal case we need to pass 6 capabilities(for APK testing) as below,

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("deviceName","ANDROID");
    capabilities.setCapability("platformVersion", "5.1");
    capabilities.setCapability("platformName",Constant.appPlatform);
    capabilities.setCapability("app", app.getAbsolutePath());
    capabilities.setCapability("appPackage", Constant.appPackage);
    capabilities.setCapability("appActivity",Constant.appActivity);
    

    Also initiate appium webdriver instead of Android as below,

    AppiumDriver driver = new AndroidDriver(new URL("http://127.0.0.1:4727/wd/hub"), capabilities);
    

    I am using appium 1.6.4 and java client 4.12 with selenium stand alone 2.53.1. AppPackage/AppActivity are required for simulator also. Hope this helps you.

    Thanks.