Am not able to turn on aero plane mode or turn off wifi using appium
I used below script:
NetworkConnection mobileDriver = (NetworkConnection) aDriver;
if (mobileDriver.getNetworkConnection() != ConnectionType.AIRPLANE_MODE) {
// enabling Airplane mode
mobileDriver.setNetworkConnection(ConnectionType.AIRPLANE_MODE);
Exception:
744 - org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\TestUser\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s ce11160bd2dwqeqa3 shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true’ exited with code 4294967295’; Stderr: 'Security exception: Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE from pid=28306, uid=2000
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE from pid=28306, uid=2000
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:23593)
at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:23442)
at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:24271)
at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:642)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:155)
at android.os.ShellCommand.exec(ShellCommand.java:96)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:18871)
at android.os.Binder.shellCommand(Binder.java:581)
at android.os.Binder.onTransact(Binder.java:481)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4775)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3862)
at android.os.Binder.execTransact(Binder.java:682)’; Code: ‘4294967295’ (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 7.85 seconds