appium / appium/java-client

Appium 2.0 - [W3C] Matched W3C error code 'invalid argument' to InvalidArgumentError

Open
#1,954 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description

Getting error while perform tap Action using W3C

Environment

  • Java client build version: 8.5.1
  • Appium Version: 2.0.0-rc.3
  • Node.js version: v14.18.0
  • Mobile platform/version: Android 12
  • Real device: Moto G20 Fusion

Code To Reproduce Issue [ Good To Have ]

Below is the sample tap action code

public void tapCenterUsingW3C()
{
           log.info("CLICKING AT CENTER OF SCREEN");
           Dimension dimension = getAppiumDriver().manage().window().getSize();
           System.out.println("dimension dimension " + dimension);
           Point point = new Point((int) (dimension.width * 0.5), (int) (dimension.height * 0.5));
           System.out.println("dimension dimension  point.getX() " + point.getX());
           System.out.println("dimension dimension  point.getY() " + point.getY());
           PointerInput FINGER = new PointerInput(TOUCH, "finger");
           Sequence tap = new Sequence(FINGER, 100)
                .addAction(FINGER.createPointerMove(ofMillis(10), viewport(), point.getX(), point.getY()))
                .addAction(FINGER.createPointerDown(LEFT.asArg()))
                .addAction(new Pause(FINGER, ofMillis(milliseconds)))
                .addAction(FINGER.createPointerUp(LEFT.asArg()));
           getAppiumDriver().perform(List.of(tap));
           log.info("CLICKED AT CENTER OF SCREEN");
  }

Link To Appium Logs

[debug] [AndroidUiautomator2Driver@3aba (07890412)] Matched '/actions' to command name 'performActions'
[debug] [AndroidUiautomator2Driver@3aba (07890412)] Proxying [POST /actions] to [POST http://127.0.0.1:10001/session/042567b1-6a57-4895-816a-60f11f23ba74/actions] with body: {"actions":[{"id":"finger","type":"pointer","parameters":{"pointerType":"touch"},"actions":[{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"},{"duration":0,"type":"pause"}...
[AndroidUiautomator2Driver@3aba (07890412)] Got response with status 400: {"sessionId":"042567b1-6a57-4895-816a-60f11f23ba74","value":{"error":"invalid argument","message":"Exception while reading JSON","stacktrace":"io.appium.uiautomator2.common.exceptions.InvalidArgumentException: Exception while reading JSON\n\tat io.appium.uiautomator2.handler.W3CActions.safeHandle(W3CActions.java:92)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:59)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:277)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:271)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:345)\n\tat io.n...
[debug] [W3C] Matched W3C error code 'invalid argument' to InvalidArgumentError
[debug] [AndroidUiautomator2Driver@3aba (07890412)] Encountered internal error running command: io.appium.uiautomator2.common.exceptions.InvalidArgumentException: Exception while reading JSON

Detailed Appium Log:

https://gist.github.com/dipakkumar1225/76f6e226e8fb1e1a5110deb30a0aad62

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Java tap-action reproduction against the listed Appium and Android versions, then compare the serialized actions with the linked Appium logs. The relevant reported entry point is the W3C /actions request, with the failure shown in W3CActions.safeHandle; done means identifying and documenting or correcting the cause of the invalid-argument response.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.