How to connect an Android device over a wireless network for Appium testing
During our Appium training courses, we use Android devices tethered to the PCs via USB. However, it is possible to use Appium against Android devices over the wireless network, just by using some simple ADB commands.
Make sure the PC with Appium and the Device are on the same wireless network!
Find out the IP address of the Android Device (Settings->About device->Status->IP Address) and make a note of this.
Connect the Android device via USB, ensure all the device drivers are installed, open a command prompt on the PC and type:
and press enter to check USB connectivity before proceeding.
While still connected by USB, in a command window, type
adb tcpip 5656
(where 5656 is a user allocated port number – so can be any free port number you choose)
This will restart the adb connection to the device in TCP/IP mode
Disconnect the device from USB
Connect to the phone wirelessly using
adb connect 10.0.0.61:5656
at a command prompt (where 10.0.0.61 is replaced with the IP of your device that you noted in step 2)
Use adb devices again to check connectivity success
Here is how to use the Desired Capabilities to now connect and run a test wirelessly:
capabilities.setCapability (“udid”, “10.0.0.61:5656”);
where the IP address will be whatever you noted in step 2 (also shown when using adb devices)
For more information on our Appium courses see: Appium Training