java-client: Set ChromeOptions with androidProcess in DesiredCapabilities will raise error

Description

Set DediredCapabilities with androidProcess in ChromeOptions as below:

DesiredCapabilities desired_capabilities = new DesiredCapabilities(); desired_capabilities.setCapability(AndroidMobileCapabilityType.PLATFORM, "Android"); desired_capabilities.setCapability(AndroidMobileCapabilityType.VERSION, "6.0"); desired_capabilities.setCapability("deviceName", "Android"); desired_capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.tencent.mm"); desired_capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "ui.LauncherUI"); desired_capabilities.setCapability("showChromedriverLog", true); desired_capabilities.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true); desired_capabilities.setCapability("noReset", true); ChromeOptions chrome_options = new ChromeOptions(); chrome_options.setExperimentalOption("androidProcess", "com.tencent.mm:tools"); desired_capabilities.setCapability(ChromeOptions.CAPABILITY, chrome_options);

When try to launch driver, appium will give the Error: Could not find package com.android.chrome on the device

This error happened with java client 6.0.0, but it is ok with 5.0.0

Environment

  • java client build version or git revision if you use some shapshot: 6.0.0
  • Appium server version or git revision if you use some shapshot: 1.8.1
  • Desktop OS/version used to run Appium if necessary: Mac High Sierra
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: 10.1.0
  • Mobile platform/version under test: Android 6.0
  • Real device or emulator/simulator: emulator

Details

Please provide more details, if necessary.

Code To Reproduce Issue [ Good To Have ]

Ecxeption stacktraces

https://gist.github.com/megolee/9e010f6efb7d9572494cbb3fd4c00061

Link to Appium logs

java client 6.0.0: https://gist.github.com/megolee/8d9c4dd279d70e34dd5934c0e9886ce8

java client 5.0.0: https://gist.github.com/megolee/60d9b9746531343bea886ae1e4757c7c

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 36 (10 by maintainers)

Most upvoted comments

@megolee @512433465 we need to raise this to selenium. They are setting browserName to chrome by default when ChromeOptions object is created.

As workaround can u try this

DesiredCapabilities desired_capabilities = new DesiredCapabilities();
ChromeOptions chrome_options = new ChromeOptions();
	chrome_options.setExperimentalOption("androidProcess", "com.tencent.mm:tools");
	desired_capabilities.setCapability(ChromeOptions.CAPABILITY, chrome_options);
	desired_capabilities.setCapability(AndroidMobileCapabilityType.PLATFORM, "Android");
	desired_capabilities.setCapability(AndroidMobileCapabilityType.VERSION, "6.0");
	desired_capabilities.setCapability("deviceName", "Android");
	desired_capabilities.setCapability(MobileCapabilityType.FORCE_MJSONWP, true);
	desired_capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.tencent.mm");
	desired_capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "ui.LauncherUI");
	desired_capabilities.setCapability("showChromedriverLog", true);
	desired_capabilities.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS, true);
	desired_capabilities.setCapability("noReset", true);
        desired_capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"");
	desired_capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
	
	
	
	try {
		driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"),desired_capabilities);
	} catch (MalformedURLException e) {
		e.printStackTrace();
	}
	

}