Sometimes if your mobile usb cable doesn’t work and you want to automate android devices using appium, then you can use adb commands to connect to PC via wifi.
Follow the steps
- Connect android device to PC via USB
make sure you enable Developer options on mobile and connect
- Navigate to your android sdk installed folder | platform-tools, Shift + right click on explorer and click on “Open command prompt here”,
- Get the android [device name], enter below command
- Connect device with tcpip connection
adb [device name] tcpip 5555
- Find your [device ipaddress], get your ip address by navigating to settings | about phone | status
adb connect [device ipaddress]
- Disconnect android device from PC, remove usb cable [switching from usb to wifi mode]
output – [ip add]:5555
Now you can run your appium scripts on device via wifi from PC.