Autoplay



Transcripted Summary

# How to use a real Android device using Appium

Now, what if I wanted to run on a real device, an Android real device? Do I need to change anything in my script?"

Actually, the only thing that we need to change is the device name.

In our previous example, we are adding that the deviceName is "Android Emulator", but for the real or physical device, you should add the physical or the Android name.

For example, here from the command line, I can run:


adb devices

I already connected my device, so this is the device ID, but I need to add the device name.



So, I'm connecting my physical device using a USB cable and here I am opening the "Reflector" application, which mirrors my physical device to my Mac operating system.

Here you should only open or use USB debugging mode and here in the connection, you should enable the developer mode to be able to install the application.

In the "System", you should have "Developer options" and it should be on.



If it's not on, you just need to go to the System setting and enable it.

This is the only thing that you want to do for running your script on a physical device.

In "About phone", you can find the device name - in my case, it's a Nexus 6P.

So I will just change the value of deviceName in my script to "Nexus 5P" and then also change the platformVersion.

My version is not "9.0" because if I open my version, you will find that the system is "8.1.0".

So I will change platformVersion to "8.1.0" and try to run my script now on the physical device and check what happened.

Here is my physical device and I will run the Appium server.

I will open the Appium server beside the device to be able to check what is happening during the session.

Here I'm opening the application, installing the Appium Settings APK first, then installing the APIDemo APK, and then start running the script.



The application is opened, and I clicked on the app button and my script has passed already.

So, the things that we need to change are the device name and the version - so you need the specifications of the device and you need to make sure that you enable "Developer mode" on the physical device to be able to run your test script on the device.



Resources



Quiz

The quiz for this chapter can be found in Chapter 4.8

© 2024 Applitools. All rights reserved. Terms and Conditions Privacy Policy GDPR