Page tree
Skip to end of metadata
Go to start of metadata

If you wish to test web applications using Chrome on Android, you can initialize the driver as ChromeDriver. What this means is that commands and actions will be carried out by ChromeDriver, allows for more accurate and error-free web application tests. The implementation of ChromeDriver takes into account testing outside the web application. In case you change the context from Web to Native App, commands will be delegated through Appium Driver; if you switch back to Web context, commands will once more be delegated to ChromeDriver.

To initialize ChromeDriver, you need to set it in the test capabilities:


Java
dc.setBrowserName(MobileBrowserType.CHROME);
Python
self.dc['browserName'] = 'chrome'
C Sharp
dc.SetCapability(MobileCapabilityType.BrowserName, MobileBrowserType.Chrome);

Set Experitest Url

Please make sure you replace  with appropriate URL in the sample code below.

Ruby
desired_caps = {
        caps: {
			...
            browserName: 'chrome',
			...
        },
        appium_lib: {
            server_url: '<EXPERITEST_URL>',
        }
    }



Setting this capability will cause Chrome browser to launch immediately once the test starts. It is not possible to set this capability alongside app related capabilities (AndroidMobileCapabilityType.APP_PACKAGE, AndroidMobileCapabilityType.APP_ACTIVITY) because the MobileBrowserType capability takes precedence.

The corresponding context is "CHROMIUM". If you want to switch to Native app context and back, you need to set the context to "CHROMIUM":


Java
driver.context("CHROMIUM");

Python
self.driver.switch_to.context("CHROMIUM")

C Sharp
driver.Context = "CHROMIUM";
Ruby
@driver.switch_to.context("CHROMIUM")



  • No labels