0

For automating android app I am using AppiumDriver

 AppiumDriver driver = new AppiumDriver(new URL("http://localhost:5555/wd/hub"), capabilities);

I have found in web using RemoteWebDriver

 RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:5555/wd/hub"), capabilities);

Is there any need for using different drivers. If yes,for automationg iOS app which driver I need to use?

Venkatesh G
  • 8,466
  • 4
  • 13
  • 22

1 Answers1

1

There are multiple possibilities for what driver to use and the difference is how much platform specific features you wish to have available.

For Android the most specific driver would be AndroidDriver. AndroidDriver extends AppiumDriver (the one you're using right now) and AppiumDriver extends RemoteWebDriver. In other words, RemoteWebDriver has least features and going one level further with a driver brings more choices.

Java-client's AndroidDriver: http://appium.github.io/java-client/io/appium/java_client/android/AndroidDriver.html

Inheritance of AndroidDriver as seen in the API documentation page:

java.lang.Object
  org.openqa.selenium.remote.RemoteWebDriver
    io.appium.java_client.AppiumDriver<T>
      io.appium.java_client.android.AndroidDriver<T>

Note that AppiumDriver and AndroidDriver include the <T>, which allows you to choose what type of MobileElements you're using. To access all Android specific features of the driver, you may want to define <T> to <AndroidElement>: http://appium.github.io/java-client/io/appium/java_client/android/AndroidElement.html

Inheritance of AndroidElement:

java.lang.Object
  org.openqa.selenium.remote.RemoteWebElement
    io.appium.java_client.MobileElement
      io.appium.java_client.android.AndroidElement

iOS has similarly IOSDriver: http://appium.github.io/java-client/io/appium/java_client/ios/IOSDriver.html With inheritance of:

java.lang.Object
  org.openqa.selenium.remote.RemoteWebDriver
    io.appium.java_client.AppiumDriver<T>
      io.appium.java_client.ios.IOSDriver<T>

In many cases it's enough to simply use the AppiumDriver together with <WebElement> (this is used by default) or <MobileElement>

Lasse
  • 880
  • 5
  • 11
  • Can we use AppiumDriver with out or – Venkatesh G Aug 26 '16 at 04:20
  • 1
    Some Element type is always in use. If you don't define it, WebElement will be in use by default. You can use WebElements in Android/iOS app automation just fine, but with less features to manipulate the elements with. – Lasse Aug 26 '16 at 06:51