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.

Set ChromeOptions with androidProcess in DesiredCapabilities will raise error

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
saikrishna321commented, Nov 9, 2018

@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();
	}
	

}

1reaction
megoleecommented, Nov 12, 2018

@saikrishna321 Already raise an issue in selenium project https://github.com/SeleniumHQ/selenium/issues/6643

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pass driver ChromeOptions and DesiredCapabilities?
Basically, you can add ChromeOptions to DesiredCapabilities then create ... setUp() throws Exception { System.out.println("Launching Google ...
Read more >
while - TesterHome
Original error: Failed to start Chromedriver session: An error occurred (Original ... true [Appium] chromeOptions: { androidProcess: 'com.tencent.mm:tools' } ...
Read more >
Chrome Options & Desired Capabilities in Selenium Webdriver
Create an object of Chrome Driver class and pass the Chrome Options Selenium object as an argument.
Read more >
Chromium | WebdriverIO
Whether it should automatically raises errors on browser logs. Non official and undocumented Chromium command. More about this command can be found here....
Read more >
How to fix common Selenium errors? - Ultimate QA
cs from Selenium. This means that the old way of setting the ChromeOptions or DesiredCapabilities will no longer be possible. So this will...
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