If you want to run android app automation test using Appium in physical android device such as phone or pad, you need to first enable USB debugging mode in your physical android device and then connect it with your PC using data line. Below are steps about how to do that.
Step 1: Enable Developer Options.
This is the prerequisites before you can enable USB debugging mode on android device. If you have already do this step before, then you can go to step 2 directly.
- Click Settings icon in main screen.
- Scroll down in Settings menu list, check whether there is a menu named ” Developer options ” at bottom, if you see that option you can click it into detail to disable it or enable it. That means you have do this step before, you can skip step 1 and go to step 2. In my example you can see that option because i had enabled it before.
- If you do not see ” Developer options ” menu, you should go to ” About phone ” menu and tap it.
- Scroll down to ” Build number ” menu item in ” About phone ” menu list.
- You need totally tap seven times on ” Build number ” menu item, after the first three tap, it will popup message show you something like ” If you continue tap twice or more you will be a developer “, keep typing until you see another message like ” You are developer now. ” like below picture.
- Then go back to Settings menu list, you can see ” Developer options ” menu item in it.
Step 2: Enable USB Debugging Mode
After enable ” Developer options ” menu in step 1, you can enable USB debugging mode now. But what I want to remind you of is that do not make your android phone or pad in USB debugging mode always, just enable it when you needed. There are security risk in that mode because it permit high-level operation on your android device. So disable this option immediately after you use it. This can make your phone safety.
- Type on ” Developer options ” menu item in Settings menu list.
- Check ” USB debugging ” checkbox to enable it.
- It will prompt you to ask whether ” Allow USB debugging ” or not, click OK button.
- Now the enable USB debugging mode operation is completed successfully.
Step 3: Check Whether Device Is Connected With PC Properly
Use a USB line to connect your android device with PC, then you can run below dos command to verify that android devices in USB debugging mode is connected with PC properly.
- Open dos window.
- Execute command ” adb devices “. Then you can see connected android devices list as below.
- If you can not see any device, maybe it is because of connection issue or you do not enable USB debugging mode correctly. The most possible reason is that you do not install your android device USB driver correctly in your PC. Click here to download Samsung device USB driver,
Click here to download Lenovo device USB driver , Click here to download HTC device USB driver. Otherwise you can go to your phone’s manufacturer website to download related USB driver.
Install Google USB Driver In Android SDK Manager
If you really can not find correct USB driver for your android device, you can install google’s default USB driver, it can be used to install some android devices.
- Launch Android Studio, click ” Tools —> Android —> SDK Manager ” menu item.
- In the popup dialog, check ” Google USB Driver ” checkbox, click Apply button. Then click Finish button in next dialog to complete the install.
- Click windows Start menu, input “Device Manager” in windows command input box. Click Enter.
- In the device manager widow, right click your portable devices.
- Click Properties menu in above popup menu list. It will open detail properties dialog. Click ” Update Driver ” button.
- Browse to the google USB driver saved directory. Commonly you can find the driver in your android sdk installation directory like
- After install google provided USB driver, you can see that device use adb devices command.
Now you can run native android app automation test in your physical android device using Appium and selenium webdriver, we will introduce that in later articles.