Skip to content

How to start an AppiumDriver when the server is launched remotely or locally

Sergey Tikhomirov edited this page Jan 5, 2016 · 7 revisions

It is not a big deal to start an AppiumDriver using the URL to the Appium server launched remotely/locally.

Android

...
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;

...

DesiredCapabilities capabilities = new DesiredCapabilities();

capabilities.SetCapability("deviceName", "Android Emulator");
capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("app", "<Path to your app>");

AppiumDriver<AppiumWebElement> driver = new AndroidDriver<AppiumWebElement>(
                           new Uri("http://127.0.0.1:4723/wd/hub"), 
                               capabilities);		

iOS

...
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium.iOS;
...

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(MobileCapabilityType.
                                PlatformVersion, "8.0");
capabilities.SetCapability(MobileCapabilityType.
                                DeviceName, "iPhone Simulator");
capabilities.SetCapability(MobileCapabilityType.App, 
                                <path to your app>);
AppiumDriver<IOSElement> drive = new IOSDriver<IOSElement>(
                               new Uri("http://127.0.0.1:4723/wd/hub"), 
                                 capabilities);