In order to Run Appium automation tests in real android device, we need to connect real android device to PC by enabling USB debugging mode.
To test on a real device or on on a simulator, we need SDK to be installed on your machine. Appium will take the advantage of the SDK to connect to the real device connected via USB or simulator. And Appium only Supports to test on Android, IOS and Firefox OS only. Appium still does not support test execution on Windows OS (Appium team working on it, they may release updated version with Windows OS support soon).
First Enable Developer Option, To enable Developer Option in android device, Click on Settings and find out ‘About Phone’ option.
Step 1 : Click on About Phone option
Step 2 : Click on Version Information
Step 3 : Now you will find an option called ‘Build Number’.
Step 4 : Keep clicking Build number option for seven times. It starts showing you information message as ‘You are now 2 steps away from being a developer’
Step 5 : and again ‘You are now 1 step away from being a developer’
Step 6 : And After clicking for 7 times, finally it will show a message as ‘You are now a developer!’
Step 7 : Now you can see ‘Developer Options’ from where you can enable ‘USB debugging’.
Step 8 : Click on ‘Developer Options’, which will show you multiple options available
Step 9 : Check ‘USB debugging’ option, Once we check that option, it will display warning
Step 10 : Click on OK to continue. Done!!!!! Now we have successfully enabled USB debugging mode for android device.
Finally, To make sure if the device is connected properly with USB debugging mode, we can check using command prompt, Open command prompt and enter ‘adb devices’, which will show you the device connected.
NOTE: All the above steps are done on my mobile, And settings may be slightly different on your phone. If you are facing any issues in enabling USB Debugging on your Phone, please search with your mobile manufacturer website for more details or Google it if you face any issue.
When you run any test, without connecting the device to PS, you will get error as' org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find a connected Android device. (WARNING: The server did not provide any stacktrace information). Command duration or timeout: 31.35 seconds.
In the next tutorials, We will see how to execute Appium tests on Android Real device by taking simple example.