Hello,
I am using setConnection(Connection.NONE)
method to switch on/off wifi settings in my device. However it doesn’t work… Any workaround of this? I don’t want to use adb because later on, I will be running the tests on perfecto cloud.
Here is my code -
driver.setConnection(Connection.NONE); Thread.sleep(5000); Assert.assertEquals(Connection.NONE, driver.getConnection());
I get assertion failure -
junit.framework.AssertionFailedError: expected:<NONE> but was:<ALL>
It gives nothing in error, but also does nothing in device.
Here is the logs from Appium -
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Client connected
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args:
[“-P”,5037,“-s”,“34044ca3af9f3269”,“shell”,“settings”,“get”,“global”,“airplane_mode_on”]
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args:
[“-P”,5037,“-s”,“34044ca3af9f3269”,“shell”,“settings”,“get”,“global”,“wifi_on”]
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args:
[“-P”,5037,“-s”,“34044ca3af9f3269”,“shell”,“settings”,“get”,“global”,“mobile_data”]
[debug] [MJSONWP] Responding to client with driver.setNetworkConnection() result: 6
[HTTP] ← POST /wd/hub/session/1b6370aa-ce54-4406-8238-01198e70eef7/network_connection 200 24457 ms
- 73
[HTTP] → DELETE /wd/hub/session/1b6370aa-ce54-4406-8238-01198e70eef7 {}
[debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: [“1b6370aa-ce54-4406-8238-01198e70
eef7”]
[debug] [BaseDriver] Event ‘quitSessionRequested’ logged at 1501677171926 (18:02:51 GMT+0530 (India
Standard Time))
[debug] [AndroidDriver] Shutting down Android driver
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args:
[“-P”,5037,“-s”,“34044ca3af9f3269”,“shell”,“am”,“force-stop”,“com.mp”]
[debug] [ADB] Pressing the HOME button
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘C:\Users\AppData\Local\Android\sdk\platform-tools\adb.exe’ with args:
[“-P”,5037,“-s”,“34044ca3af9f3269”,“shell”,“input”,“keyevent”,3]
[debug] [AndroidBootstrap] Sending command to android: {“cmd”:“shutdown”}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“shutdown”}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:“OK, shutting down”
}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state ‘stopping’
Libraries -
Java-client - 4.1.2
Appium - 1.6.4
Device - Sony Xperia Z5
Device OS - 5.1.1
Kindly help…
Many thanks!