Appium allows us to execute our tests on both real devices and emulators/simulators. We have seen earlier on how to execute tests on real Android Devices. However, we may not have enough real devices to test always with different versions of android. In such cases we can use android emulators that emulates real device software, hardware and OS.
As we all know, we use selenium grid to run our tests on different browsers/operating systems in parallel to reduce the execution time. Now we will increase our environment to run tests on mobile browsers (Android/iOS) using Appium.
Before start writing test scripts, we need to identify elements like id, name, class etc to perform actions. In order to identify elements, we use
UIAutomatorViewer to capture snapshot of current device screen which shows the hierarchy of the UI components arranged in the screen.
There are multiple ways to start appium service, manually we can start by clicking on appium icon, start using command prompt and programmatically. In this tutorial, let us see how to start Appium server programmatically. We can achieve this with the help of Appium java Client 'AppiumDriverLocalService' class.
In the previous tutorials, we have seen executing Appium tests on a real devices by plugging USB to PC. Now here will execute Appium tests on wifi by enabling wireless adb on the device without connecting to PC with a USB cable.
Before proceeding further, you should make sure Android SDK is configured in your machine AND should have enabled ‘USB debugging’ from 'Developer Options' in your android device.
Step 1 :- Connect your device to computer via USB and check if it is connected using 'adb devices' which will list you the devices connected to your machine.
In the previous tutorials, we have seen executing appium tests on a real device by using chrome browser (Mobile Web App) . Now in this tutorial we will take a very basic native app and execute Appium tests on a real device for that app.
To execute Appium tests on Real device, we need to make sure that device is connected to PC and has Developer Mode option enabled. Once device and app are configured, we can run our tests on that device by passing the desired capabilities.
I Assume all the below Prerequisites are installed and configured :-
Before proceeding to install Appium Make sure you have installed JDK and Android.
We can run an Appium server using node.js or using the AppiumUI application. First we will see steps to install using Appium desktop and then using NodeJs which is very simple.
Appium using Desktop
First Download Appium from here Official Appium Site
Once the file AppiumForWindows_x.x.x.Zip is downloaded, please unzip the file.
It is very simple to install, Please Download Android Studio (which includes Android SDK ) from Official Android website.
1. Once you have download, proceed to install by clicking on android studio exe file.
2. After above steps are Done, you would the below structure in the sdk folder like below: