I am writing tests via Python + Selendroid. I am looking for way how to automate connecting Android device to Wi-Fi network. The product feature is: firstly we need to connect to X network, do something, and then connect to Y network. Does it possible to implement using Selendroid or Appium? Is it possible automate? If it's not, why so?
You can resolve your problem using adb
and wpa_cli
, but your device must be rooted.
adb root
adb shell
svc wifi enable
wpa_cli -p /data/misc/wifi/sockets/ -i wlan0
add_network
set_network 0 auth_alg OPEN
set_network 0 key_mgmt WPA-PSK
set_network 0 psk "12345678"
set_network 0 proto RSN
set_network 0 mode 0
set_network 0 ssid "Qwerty"
select_network 0
enable_network 0
reassociate
status
For more information and examples refer Connect to Secure AP using WPA Supplicant