This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 12
Jul 2016

Hi all, i am testing a scenarios that i will test in case of wifi/ data is off and in case of wifi/data is on.
So now i have to automate the turn on/of data/wifi.
I search a lot on the forum and see the adb command
to turn of data :
adb shell am start -n io.appium.settings/.Settings -e data off
to turn on data :
adb shell am start -n io.appium.settings/.Settings -e data on
But there command does not work, after the command is executed , then the correct message is shown. but the data is not turn off or turn on.
can any one help here.

  • created

    Jul '16
  • last reply

    Sep '18
  • 11

    replies

  • 6.6k

    views

  • 6

    users

  • 3

    likes

  • 4

    links

Hi,
Java client has this utility function - Check this.

import io.appium.java_client.NetworkConnectionSetting;

NetworkConnectionSetting connection_wifi_off = new NetworkConnectionSetting(false, false, false);
NetworkConnectionSetting connection_wifi_on = new NetworkConnectionSetting(false, true, false);

Hi RamS,

Actually, i tried to use NetworkConnectionSetting before. But IDE say that this API is deprecated and will deleted on next release.
So that i think Java does not support this API any more.
So we can still use it ? NetworkConnectionSetting?

Hi Telmo_Cardoso,

How about Appium API version>4.0.0? In this case, what solution is applied for network connection?

Because, when we build automation test case, our customer will not know about the appium version ....

They just care if the automation test case run successfully or not. And if they use apppium api version >4.0.0. What do you think about this case?

Please read the complete article. He talks how it was (<4.0.0) and how it is now (>=4.0.0)

Hi Telmo_Cardoso,

I see it now. Sorry because at first, it didnot have look on the link you provide.
Thanks so much Telmo_Cardoso.
And it works from my side now. thanks

7 months later

Hello,

Currently I am using this method to switch on/off wifi.. It is working smoothly in my windows machine, but when I connect my device with Mac, it is not switching off the wifi.

P.S - I have setup the Android Home and path correctly, also I am able to see the device list while performing adb devices in terminal..

I am blocked, and any help would be appreciated here.. @willosser

Thanks!

1 year later

Hi Telmo_Cardoso
I tried adding the same in my project but its not recognizing the “Connection” .
I went through some of the other links, and there was one suggestion to add this Mvvn Repository2 to my project.
Have done that still its not working.
Can you please help me with Which Jar or Dependency to be added to make it work.

Thanks in advance.