java-client: Android: Cannot call non W3C standard command while in W3C mode

The problem

On trying to create a new android session, i am seeing this message after the session gets created. Unknown command: Cannot call non W3C standard command while in W3C mode

I don’t see this issue if i remove the capability: dc.setCapability(MobileCapabilityType.AUTO_WEBVIEW, true);

Switiching to webview works if i use driver.setContext() and i do not see W3C error. But the error is seen with doesn’t work with AutoWebview.

I am using java client 7.2.0 in this process

Environment

  • Appium version (or git revision) that exhibits the issue: v1.15.0-beta.1
  • Node.js version (unless using Appium.app|exe): v10.16.2
  • Npm or Yarn package manager: 6.9.0
  • Mobile platform/version under test: 7.0
  • Real device or emulator/simulator: Moto G4
  • Java Client : 7.2.0

Details

Desired capabilities:

            DesiredCapabilities dc = new DesiredCapabilities();
            if(aut.equalsIgnoreCase("android")){
                dc.setCapability(MobileCapabilityType.DEVICE_NAME, "Moto G4");
                dc.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
                dc.setCapability(MobileCapabilityType.PLATFORM_VERSION, "7.0");
                dc.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 500);
                dc.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir")+"/app/xxx.apk");
                dc.setCapability(MobileCapabilityType.AUTO_WEBVIEW, true);
                dc.setCapability(MobileCapabilityType.FORCE_MJSONWP, true);
                dc.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true);
                dc.setCapability(AndroidMobileCapabilityType.SUPPORTS_ALERTS,true);
                driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), dc);
            }

Link to Appium logs

https://gist.github.com/mayureshshirodkar/cf37d78bbdb847457914d667a3ada519

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (3 by maintainers)

Most upvoted comments

@roddymunro Wow, so complicated. How about

capabilities.setCapability("appium:chromeOptions", ImmutableMap.of("w3c", false));

This worked for me with ChromeDriver 76:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("w3c", false);
capabilities.merge(chromeOptions);
driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

@roddymunro Wow, so complicated. How about

capabilities.setCapability("appium:chromeOptions", ImmutableMap.of("w3c", false));

This worked for me (Y)

Hi @mykola-mokhnach does the recently released java client 7.3.0 have this fix?

Using Android emulator with: pixel 4 Android 11 Chromdriver 83

getting error: Cannot call non W3C standard command while in W3C mode is there a fix for that ?

Not happening on android 10

@roddymunro Wow, so complicated. How about

capabilities.setCapability("appium:chromeOptions", ImmutableMap.of("w3c", false));

This worked for me… thanks

For anyone facing this issue. I have resolved it by using latest changes from the master branch of java client.

Using Maven:

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

        <dependency>
            <groupId>com.github.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>master-SNAPSHOT</version>
        </dependency>