Testsigma logo[Webinar] Witness Mobile Test Automation Like Never Before Register Now

Selenium And Mobile Test Automation – Can Selenium Be Used For Mobile Testing?

Selenium And Mobile Test Automation – Can Selenium Be Used For Mobile Testing?

| April 28, 2021

Selenium is a tremendously popular automated testing tool for desktop, web applications. Testing on mobile devices is a major requirement that has grown exponentially in recent years. 

Why has the mobile testing requirement grown so much? The answer is pretty clear. Just look at how dependent each one of us has become on a mobile phone.

Today mobile phones are as vital as breathing for us. That is the reason that going without a mobile phone for even a few hours seems impossible for us.

What makes a mobile phone so useful though? Mobile applications!

These mobile applications have become the life of a mobile phone. Think of a task you want to do and there would be a mobile application to do just that, already there in the marketplace.

So, on the one hand where there are companies that are busy manufacturing mobile devices in all shapes and sizes to cater to all the different types of needs and budgets. 

The development of mobile applications is also at an all-time high. How high? Below are few statistics that will give you an idea:

  • Mobile applications are expected to generate over $935 billion in revenue by 2023
  • The Apple App Store has 1.96 million apps available for download
  • There are 2.87 million apps available for download on the Google Play Store
  • 21% of Millennials open an app 50+ times per day.

When the number and usage of mobile applications are so high, it also means there is very high competition out there. It also means that for an app to be successful, quality will play a major role.

Thus, mobile application testing will play a crucial part here. And for the well-established applications, automated mobile testing will emerge as a must too. 

For automated mobile testing, a tool is needed. We know Selenium is widely used for automating web applications. So, can we use the same Selenium for automated mobile testing too? Let’s find out in this article.

Can Selenium be used for mobile testing?

No, we cannot directly use Selenium for automated mobile application testing. However, we have frameworks supported by Selenium to automate mobile application testing.

Selenium supported frameworks for mobile test automation are:

1. Selendroid

2. Appium

Should you automate mobile application testing using Selenium?

Now we understand that directly we cannot use Selenium to write automated test scripts for mobile application testing. Hence, we need to use Selenium-supported frameworks like Appium and Selendroid.

The testing process for using Appium and Selendroid has the below steps:

Test Script Development

This step means writing the automated test scripts in programming languages. If you are already aware of Selenium, then writing the test scripts will not require learning new skills. However, we know well that writing automated test scripts ourselves is time-consuming, and to receive ROI(Return On Investment), we need to wait longer.

Test Management

We understand that Selendroid and Appium are open-source automation tools. Because of this reason, the test management provided by them is not so impressive. 

Selendroid records the element clicked and then saves the locator and command. Appium also has such a recorder but that works only for iOS mobile applications. 

Hence, we only receive the test locators and commands but in any case, test scripts are not recorded. Therefore, if we are using any of these two frameworks then we need to add a third-party test management tool ourselves. 

Backward Compatibility

Appium works on Android devices with Android 4.0 and above. To solve this problem nowadays Appium comes integrated with Selendroid to provide backward compatibility.

However, this is not as effective as the original Selendroid framework. So to provide backward compatibility for Android devices with lower API versions(API 10-17), we should use Selendroid.

Gestures Testing

Mobile device applications work on hand gestures and therefore it is necessary for Appium and Selendroid to recognise these gestures efficiently. The happy news is that they both do it effectively via dedicated APIs. Selendroid is a winner in this case because it provides ‘Advanced User Interactions API’ which is useful for complex gestures as well.

While above are Selenium supported frameworks for mobile test automation, you can read more in detail about the tools that can be used for mobile application testing.

Another tool that needs a mention here is  Testsigma which requires no coding for automated mobile testing. We can write the test cases in plain English and run them on cloud-based, thousands of environments. It is backed by strong AI algorithms to make the user’s testing experience smooth & easy.

It covers parallel testing and compatibility testing by providing direct access to thousands of environments without any setup hassles. Thus, helps us save the cost of setting up a cross-browser test lab.

Just choose, pay, and use. So simple to use & considerably saves time and effort.

With its latest release, Testsigma is set to change mobile test automation forever. Witness the change live on 11th August

Let’s now learn about Selendroid and Appium tools in detail.

Selendroid

Also known as ‘Selenium for Android’, this is used to test mobile applications for Android. It uses JSON Wire protocol and provides backward compatibility to the older Android versions. However, by using an iOS driver it can be used to test iOS mobile applications as well.

Features of Selendroid:

  • Works on Android applications (Native, Hybrid)  and Mobile web applications.
  • Used for parallel testing of a mobile application on multiple devices simultaneously with the help of Selenium Grid.
  • It is open-source, hence free to use.
  • ‘Hotplugging’ is a feature where Selendroid can detect and recognise new devices plugged into it. Hence, we can remove and add new devices on the go, i.e. while tests are running.
  • It can inspect the elements on the UI with the help of a built-in inspector.
  • It supports Selenium WebDriver compatible programming languages- Java, C#, Python, etc.
  • Provides a built-in Android Driver Webview App to test mobile web applications.
  • Supports testing of gestures on the mobile device via the Advanced User Interactions API. Example- single tap, double-tap, down, up, etc.
  • Selendroid can be used on emulators and real mobile devices for automated testing.
  • Supports ‘Dynamic Extendability’, which means that the test script can be added, edited, modified while the tests are running.

Components of Selendroid:

  • Web Driver Client– a Java client library, which is installed on the computer where test scripts will be written.
  • Selendroid Server– Runs on the mobile device(real or emulator) where the application under test(AUT) is running.
  • Android Driver Webview App– It is a built-in driver to test the mobile web.
  • Selendroid-Standalone- It is used to install AUT and Selendroid Server.

Read detailed architecture here.

Appium

It is a more popular choice for mobile automation testing because it supports both iOS, Windows desktop, and Android mobile applications. It comes with a built-in Selendroid mode for testing older versions of Android applications. It also uses the JSON Wire Protocol like Selendroid.

Features of Appium:

  • Appium works on a client-server architecture.
  • It has an HTTP server that is written in Node.js and helps the communication between client and mobile device. The clients are Ruby, PHP, C#, Python libraries which provide commands to the mobile device.
  • Provides automated testing for iOS and Android (Hybrid, Native, and Web applications). Also, it can be used for testing Windows desktop applications.
  • Since it works on iOS, Windows, and Android, it is used for cross-platform testing.
  • It is also Open-Source, hence free to use.
  • The same test scripts can be used for iOS, Windows, and Android using the same API. Hence, it allows code reusability.
  • Appium is more popular hence it has a large and active user community.
  • If there is a small code change in the application then we do not require to re-install the application for testing with Appium. The reason being it does not access the source code of the application. Other automation tools such as Selendroid and Robotium require reinstallation/rebuild when any small changes are made to the application under test(AUT).
  • Appium also supports parallel testing of test scripts on multiple devices.

Components of Appium:

  • Appium client– The automation test scripts which are written in Java, C#, Ruby, Python, etc. are clients for Appium.
  • Appium server– It is written using Node.js. It receives connection and command requests from the client written in JSON. After receiving the requests it executes them on the mobile devices. Appium server creates sessions to communicate with the devices on which mobile application is installed.
  • End device– These are the mobile devices (real or emulator), the automated test scripts are executed on the end device.

Now we know that Appium and Selendroid have their own share of benefits and usage. They are used according to the specific project testing needs. Appium is a good choice for automation of functional, regression, compatibility, and integration testing of Android and iOS applications.

If we are testing Android version 10-17 then we should use Selendroid since it provides backward compatibility. Also, if we need better community support, better would be Appium.

Having said this, if you are looking for an end to end automation tool for mobile testing with a stable mobile inspector, then you may try Testsigma. You need not write the test scripts in programming language and will have a large pool of environments to choose from!

To get started or Talk to our experts for a quick walk-through!