How to enable wifi using appium in android local device ? – pCloudy – Question and Answers
Home >> Appium Tricks and Tricks >> How to enable wifi using appium in ...

How to enable wifi using appium in android local device ?



String adbCommand = "adb shell am broadcast -a io.appium.settings.wifi --es setstatus enable";
runCommand(adbCommand);
public String runCommand(String command) throws InterruptedException, IOException {
p = Runtime.getRuntime().exec(command);
// get std output
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
String allLine = "";
int i = 1;
while ((line = r.readLine()) != null) {
allLine = allLine + "" + line + "\n";
if(line.contains("Console LogLevel: debug") && line.contains("Complete")) {
break;
}
i++
}
return allLine;
}


Description By this script we can enable wifi in android devices.By enabling the wifi we can connect to a network using this script.

Leave a Reply

Your email address will not be published. Required fields are marked *