What is the difference between "AppiumDriver<WebElement>" and AppiumDriver<MobileElement>?

@pr4bh4sh @prathyusha_nama @Priyank_Shah

What is the difference between "AppiumDriver WebElement " and "AppiumDriver MobileElement ?

Is it possible to get all the MobileElements when I use AppiumDriver WebElement ?

Thanks,
Sanoj

You mean Appium vs. Android???

What is the difference between AppiumDriver WebElement and AppiumDriver MobileElement ?

First, can I advise you to put the language you are using in your posts? It really would help.

Second, I believe the WebElement is a parent object that is inherited (and extended) from Selenium:

http://appium.github.io/java-client/io/appium/java_client/AppiumDriver.html

MobileElement is the child object that is tailored to the needs of Appium:

http://appium.github.io/java-client/io/appium/java_client/MobileElement.html

Examining and comparing the information on those two links should give you a good idea of how these two are implemented in Java and how they relate.

Class declaration : Both Appium and Android Driver are generic classes for example you can correlate it to different collections classes/interface like ArrayList,List,LinkedList,Maps,HashMaps,Set,HasSet,TreeSet etc

using ‘[’ for less then sign and ‘]’ for greater then sign

public abstract class
AppiumDriver[RequiredElementType extends WebElement]
extends DefaultGenericMobileDriver[RequiredElementType] { }

public class
AndroidDriver[RequiredElementType extends WebElement]
extends AppiumDriver[RequiredElementType]
implements AndroidDeviceActionShortcuts, HasNetworkConnection, PushesFiles,
StartsActivity, FindsByAndroidUIAutomator[RequiredElementType] { }

Difference(s)

  1. AppiumDriver is an abstract class where as AndroidDriver is concrete class which extends AppiumDriver class
  2. AppiumDriver class does not implement any interface where as AndroidDriver class implements generic and nongeneric interfaces as seen in declaration
  3. AppiumDriver is parent class and AndroidDriver is child class
  4. AppiumDriver contains abstract,nonabstract methods where as AndroidDriver being concrete class does not contains abstract methods, it just override methods of AppiumDriver class,AndroidDriver class does not add any new method to this class
  5. Partially we can say AppiumDriver is an abstract design pattern and AndroidDriver class is its design implementation class
2 Likes