When you want to run tests on android devices, you have to connect your phone(s) to your test running machine. Adding and removing different devices to your machine is a bit of a headache and it looks messy as well. So if you want to connect your android device to your machine over Wi-Fi (wirelessly) you can do the following.
- First connect your device to your test machine
- From the command prompt/terminal, run the command
- Make sure that your device and your test machine are in the same network.
- Run the command
- (you should see the connected device to your machine)
adb tcpip 5555
- You will see a message saying “restarting in TCP mode port: 5555”
- Disconnect the device from your machine
- Get the IP address of your phone (Go to Settings > Wi-Fi > Your Connected Network > IP Address)
- You may have to long tap your network name to see the IP Address, depending on your android version
- Run the following command to connect adb to your device over Wi-Fi using the given IP Address
adb connect <your phone’s IP address>
- Your devices should now be connected
- You can verify the same by running the command
- Now you have connected your device wirelessly to your machine. You can run your Appium tests wirelessly.