Last Updated Feb 12, 2019 — Continuous Testing Expert

The similarities and differences between web and mobile test automation drivers with focus on Appium and Selenium. Read on to discover more.

There are a number of tools used for web and mobile test automation. They vary in functionality, supported platforms, and terms of use. For this purpose, we will only concentrate on two of them: Appium and Selenium.

Developers and testers use the Appium framework for the automation of web, native, and hybrid mobile applications. The Selenium framework is used for web application automation. Additionally, Selenium is written in JAVA, Appium – in JavaScript. Although at the first glance they are different, they have one common thing: Appium and Selenium use the webDriver protocol to communicate with the target platform: Appium with the mobile device, Selenium with a web browser correspondingly. Generally, a Selenium webDriver script is executable in both a mobile device browser and in a desktop browser to exercise the same actions against the same web application.

The difference between web and mobile test automation drivers

Above all the difference between web and mobile test automation drivers lies in the functionality, supported platforms, and the configuration of the test bench to run tests. Appium, in particular, acts as an HTTP server for which there are several clients: Java, JavaScript, Python, C#, Ruby. In fact, an Appium client is the wrap over the Selenium webDriver client libraries. Appium, in addition to Selenium, uses an extended set of the webDriver APIs, specific for the interaction with mobile devices. For example, Appium includes commands to support multi-touch gestures and screen orientation, to manage geolocation data, to access device logs, and many others.

The Appium server gives access to Appium users to control functions of the device under the test, such as installation and removal of an application during the test session. The same client implementations exist for Selenium. But a Selenium server is required for distributed test execution only if we need to install a Selenium grid.

To clarify, Selenium supports major browsers running in the main desktop operating systems. Appium supports a large variety of iOS and Android devices, for the officially supported versions of iOS and Android. In addition, Appium can provide the automation of MS Windows applications. On the other hand, there is a difference in efforts, which are required to configure the infrastructure for Appium and Selenium testing. To conduct Appium testing you need to install nodeJS, install Appium, configure SDK and specific device drivers and frameworks. For a Selenium testing case, there are not so many steps to configure the environment for test developments and execution, unless you install the Selenium server to run tests against Selenium Grid. Appium and Selenium stacks diagrams are shown in the pictures below.

The example of using both frameworks for mobile web automation

The common basis in both frameworks makes it possible to use them together for web and mobile test automation, despite the differences listed above. When we need to test a web application in the mobile browser, we can use both Appium and Selenium frameworks and they will complement each other in one test. Below you will see a link to a simple test in GIT, for example, which opens a page of the Amazon.com site in the Android Chrome browser on a mobile device.

Android sample test.

Test codes use both Selenium and Appium libraries to interact with the browser on a mobile device. Appium client objects are used to initialize a device driver, define the Android Chrome browser and control it. Selenium is used to define “Desired capabilities” object, which controls the device driver, mobile browser and interacts with the web application (in the test, the Amazon.com website is used), by means of the Selenium object “By”. Using these objects gives access to the web elements of the mobile browser.

The test is executed on the SeeTest platform – cloud-based platform, offering a great number of browsers and mobile devices for development and web and mobile test automation. For comparison, there is the test, that opens cloud.seetest.io website page in the Google Chrome browser on the Mac platform, then finds a few links on the page and clicks on the links found. In this case, only Selenium objects are used, which control the remote browser on the SeeTest cloud platform and perform actions specified in the test. Check out the code for the test in the link below.

Chrome sample test.

The second test is also executed on the SeeTest platform and is ready to be run. Both tests can be downloaded, compiled and launched. Use ‘mvn clean install’ command for it. As both tests are supposed to be executed on the SeeTest platform, don’t forget to add the access key from your SeeTest account to the system variables, before you launch tests.

The first example shown above illustrates both Appium and Selenium testing and is one of the examples of the web and mobile test automation. This case happens when a web application is required to be run in both the desktop and mobile browsers, which often happens nowadays.

An example of using Appium and Selenium for automation of native mobile applications

Besides a requirement to support various browsers on multiple mobile and desktop platforms, modern applications may have multiple types of client: web, desktop, mobile, which in turn can be run on diverse hardware platforms under various operating systems. For a QA engineer, above all, it means the necessity to conduct tests on all possible combinations of hardware, OS, and browser. For instance, a possible use case, when two different clients are used, is the case when a user from the mobile client performs some action and another user from the web client gets the result of this action or vice versa.

An example of such a case is a post in a social network that has to be checked by different clients. Another example is a chat, where a user from a mobile client sends a message and a user from a web client receives the message or vice versa. From the test case perspective, it will have to imitate the interaction between the two types of clients: mobile and web client. So in one test both Appium and Selenium frameworks will be used and this type of test combines both Selenium and Appium testing. In this test, Appium objects are used to manage the mobile device, while Selenium objects are used to manage and interact with the browser on the desktop platform. A test is also supposed to be executed on the SeeTest cloud service.

As for implementations, tests for these clients can be written in separate modules and executed in parallel using SeeTest for the corresponding instances. In this example, Selenium and Appium complement each other. This is another example of web and mobile test automation.

Is the Appium framework based on Selenium or not?

And finally here’s a note about automation of native mobile applications. When we write UI tests for them and interact with the elements on mobile pages, we access them through the object which is an instance of the class io.appium.java_client.MobileElement extended from the org.openqa.selenium.remote.RemoteWebElement. This means, that tests for the native mobile applications will use Selenium implicitly to access mobile page elements.

Conclusion

To sum up, Selenium and Appium are not isolated frameworks, which can be used only for web and mobile test automation correspondingly, these frameworks can be used together in one test for testing web applications in the mobile browser and for the implementation of complex test cases, which involve interactions with web and mobile clients. All these test cases can be easily executed on the SeeTest platform, which in short provides a variety of mobile devices and browsers for tests. Furthermore, SeeTest is ranked at the top among cloud platforms for conducting web and mobile test automation.

In order to see how it all works first hand, click here for a free trial.

Are you ready to scale your enterprise?

Explore

What's New In The World of Digital.ai

April 22, 2024

The Bias in the Machine: Training Data Biases and Their Impact on AI Code Assistants’ Generated Code

Explore biases in AI training data impacting code generation and learn strategies to mitigate them for fairer AI development and software innovation.

Learn More
February 22, 2024

How Futurism is Shaping Cloud Testing: A Forecast

Unlock the future of cloud testing: strategic approaches to leverage technology effectively, enhance software quality, and ensure business success.

Learn More
December 4, 2023

The Drive for Quality: Continuous Automated Software Testing for the Automotive Industry

From AI-powered test creation to self-healing systems, discover how continuous testing and innovative developments are shaping the future of connected, safe, and reliable vehicles.

Learn More