AppiumDriver

If you refer to Chapter 3, Writing Your First Appium Test, and remember the boilerplate code generated, it creates an instance AppiumDriver:

wd = new AppiumDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

Let's take some time to understand what types of driver Appium allows us to create. Certainly, AppiumDriver was generated by the boilerplate code. Let's take a look at the other drivers:

  • RemoteWebDriver: It comes from Selenium. It has two components: a server and a client. A server is a component that listens on a port for various requests from the client. The client translates the script to the JSON payload and sends it to the server using the JSON wire protocol.
  • AppiumDriver: It inherits from the RemoteWebDriver and adds functions that are handy for mobile automation. It can be used to automate both Android and iOS apps; however, it lacks device family-specific functions. The direct subclasses are AndroidDriver, IOSDriver, and WindowsDriver.
  • AndroidDriver: It inherits from AppiumDriver and adds in additional functions that are highly contextual to the family of Android devices for automation. If you are working only on an Android project, then it's highly recommended for you to use this driver.
  • IOSDriver: It inherits from and adds in additional functions that are highly contextual to the family of iOS devices for mobile automation. If you are working on iOS app automation, then it's highly recommended for you to use this driver:

Understanding the different types of driver is important as there are different methods available specifically for certain driver types, and they can help you to solve the problem of writing a lot of explicit code. All you need to do is typecast the driver and use that method. We will explore some gestures supported only for specific drivers in the next chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.142.232