Is it possible to use Selenium WebDriver and Appium WebDriver in the same code?

Hi everybody,

I try to start my application on my Android phone (with appium), and, in the same time, a chrome browser on my local computer (with selenium). My goal is to test communication between the chrome browser(on my computer) and my android application. Problem : when I try to switch context for appium webdriver, that’s doesn’t work : no context exists !

Can someone can helping me ?




yes you can, no need to switch the context, use the web/mobile driver as your test case flow goes.

you share the error and test code.
I have used it with iOSdriver and Safari web driver, works fine.

Hi Venkatesh,

Could you give us some sample codes of your approach switching between appium and web driver?


Webdriver driver;

Some test code as webdriver…

Now we need e.g. iOSDriver do cast
(iOSDriver) driver.findElementBy…

Or as Appium driver cast
(AppiumDriver) driver.some_command…

Hi @max,
You should create two drivers (an Appium driver and a Selenium driver) and then you could interact with them simultaneously. For example, to work with a local Appium server and a local Chrome, in python:

from appium.webdriver.webdriver import WebDriver as AppiumDriver
from import WebDriver as ChromeDriver

appium_capabilities = {   
    'automationName': 'Appium',
    'platformName': 'Android',
    'deviceName': 'Android',
    'app': 'APK_PATH'
appium_driver = AppiumDriver(command_executor='',

chrome_driver = ChromeDriver(executable_path='CHROMEDRIVER_PATH')


1 Like

the code @rgonalo provided is same what i would have suggested, try using that.

Follow this link if app is not showing NATIVE/WEBVIEW context(s)


Thank you to all.
I’m able now to do what I want.
A special thank to @rgonalo !

Thx guys :wink:

Dear I just wants to say the description of your question does not match with your question subject

Amit Jain

w.r.t to the same context, I have few questions.
My scenarios is that I need the Appium Android driver and Selenium Web driver to be interacted for data comparision purposes.
When the data is submitted from Mobile app (Android driver), the same data goes and sit in the Desktop Web browser application (Selenium Web driver).
I now want to compare these two data while opening the browser outside of the mobile as a standalone browser and ensure that the match is happening.

can someone please throw the inputs regarding this?

In above example, Chrome is opened as a standalone browser, not inside the mobile. You can use the same approach: open both drivers, submit data from Appium driver, get data from chrome_driver and check that they are equals.

How would you make sure both drivers(selenium webdriver and appiumdriver) are initiated on the same node if I were executing tests on grid? In my case I want to need to interact with selenium webdriver and then with Appium WinAppDriver in the same test. So I can perform file upload.

Can you share Java Code Snippet for having chromedriver been launched within app.
Currently trying to do a context switch after launching sdk to web view. Here to execute script, it is asking for chromedriver to be installed.

Not able to send chromedriver in desired capabilities stating both AppName and ChromeDriver is not allowed. Can some one help here. Few articles are there to set chromedriver at run time, but not sure how to set them at runtime. I am executing scripts via TestNG

I tried the same approach, i.e. AppiumDriver for mobile app in the Android device and Selenium Webdriver for website on desktop

but my mobile app( appium driver) quits as soon as webdriver is instantiated.

I’m trying to do similar thing but with appium 2.0(server) and webdriverio(client) and selenium for chrome browser. I getting an error ‘TypeError: $ is not a function’
can someone please help ?

I’m interested in knowing if I can use same code for testing desktop web and hybrid mobile, what happened with you?