I try work with driver.toggleLocationServices(); its work
but for driver.toggleWifi(); And driver.toggleData(); Does not work (its not support in last version)
I assume this would only reliably work on an emulator. Real device don’t allow such actions because of struct security limitations that Google has added there in recent OS releases.
True this is another way ,But she is not stable at all
Because the location and names of the buttons vary from device to device
I found the buttons and it works
But note that for WIFI there is a name of the network, if the network changes then the test will fail
Is there a more stable way to control it?
//driver.findElement(By.xpath("//[@id=‘icon’ and ./parent::[@contentDescription=‘Wi-Fi,On.,EdimaxAPa8_2EX,Button’]]")).click(); //driver.findElement(By.xpath("//[@id=‘icon’ and ./parent::[@contentDescription=‘Bluetooth,On.,Button’]]")).click(); //driver.findElement(By.xpath("//[@id=‘icon’ and ./parent::[@contentDescription=‘Mobile,data,On.,Button’]]")).click();
@Aleksei
I found another way and I think gives the solution
If you click on AirplaneMode button
Then WIFI / Data / Bluetooth shuts down
And with another click everything opens back up
It might work well for me, until there is an Appium solution