question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Client ignoring Capabilities and Bad Parameter Errors

See original GitHub issue

Description

The Java client seems to send the w3c desired capabilities in a wrong format so that the server throws an error. And the client is not sending some capabilities such as forceMjsonwp capability

Environment

  • java client: 6.0.0
  • Appium server: 1.8.2-beta
  • Desktop OS/version: Windows 7
  • Node.js version: 8.11.1
  • Mobile platform/version under test: Android
  • Real device: Google Pixel 2 (Androui 8.1) ans Samsung Galaxy S6 (Android 7.0)

Details

I always get a w3c bad parameter error if I want to set the implicit wait time outs.

[HTTP] --> POST /wd/hub/session/45e323c1-1248-4207-95b3-22a21ec5600f/timeouts
[HTTP] {"type":"implicit","ms":30000}
[debug] [W3C] Bad parameters: BadParametersError: Parameters were incorrect. We wanted "W3C prot
ad or implicit to be set" and you sent {"type":"implicit","ms":30000}
[HTTP] <-- POST /wd/hub/session/45e323c1-1248-4207-95b3-22a21ec5600f/timeouts 400 5 ms - 5372

Therefore I treid to force MJSONWP Protocol with forceMjsonwp capability. But forceMjsonwp capability is not send from java client to appium server. Seems like client is ignoring this capability. If I try to add the forceMjsonwp capability manually into a session I created by hand with a rest client everything works fine.

I tried to set forceMjsonwp capability in both ways

capabilities.setCapability(MobileCapabilityType.FORCE_MJSONWP, true);

capabilities.setCapability("forceMjsonwp ", true);

Neither is send from client to server.

Code To Reproduce Issue

public AppiumDriver<?> setupAndroidDriver(String deviceID, String androidVersion, String appPackage, String activity, String appiumServer) throws MalformedURLException{

		DesiredCapabilities capabilities = new DesiredCapabilities(); 
		capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, deviceID); 
		capabilities.setCapability("udid", deviceID); 
		capabilities.setCapability(MobileCapabilityType.FORCE_MJSONWP, true);
		capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, androidVersion); 
		capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android"); 
		capabilities.setCapability("appWaitDuration", 20000); 
		capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
		capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
		capabilities.setCapability("appPackage", appPackage); 
		capabilities.setCapability("appActivity", activity); 
		capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");
		driver = new AppiumDriver<MobileElement>(new URL(appiumServer), capabilities);
		driver.manage().timeouts().implicitlyWait(30000, TimeUnit.MILLISECONDS);

		return driver;
	}

Link to Appium logs

https://gist.github.com/FelixHahn/93faef358769bebdd34f931303b5a1ba

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
KazuCocoacommented, Jun 18, 2018

@dpgraham Yes. in Ruby and Python client, I delete forceMjsonwp from desired capability. And if the property exists, { desiredCapabilities: desired_capabilities } will send instead of {alwaysMatch: {...}, firstMatch: [{...}, ...}

0reactions
dpgrahamcommented, Jun 19, 2018

@SrinivasanTarget just so you know, it’s a non-standard capability, it’s just there so that users can fall back to MJSONWP.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve the "Parameter validation failed" error in AWS ...
1. Open the AWS CloudFormation console. · 2. In the navigation pane, choose Stacks. · 3. Form the Stack name column, choose the...
Read more >
[MS-ADCAP]: Bad Parameter Error - Microsoft Learn
If the client sends a request where any of the following is true: The SOAP header (section 2.2.3.5) contains an empty, not present,...
Read more >
Analytics error codes - Firebase - Google
Error Code Cause Value 4 Event parameter value is too long Name of invalid parameter 5 Event has more than 25 parameters None 7 User property...
Read more >
RESTful API - Correct behaviour when spurious/not requested ...
Should we ignore it or reject the request with a BAD_REQUEST 400 status error? We can assert that the request is bad because...
Read more >
400 Bad Request Error: What It Is and How to Fix It
Oftentimes, if you're trying to diagnose an issue within your own application, you can immediately ignore most client-side code and components.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found