diff --git a/appium/webdriver/mobilecommand.py b/appium/webdriver/mobilecommand.py index 0a30f5455..50d8e132f 100644 --- a/appium/webdriver/mobilecommand.py +++ b/appium/webdriver/mobilecommand.py @@ -28,6 +28,7 @@ class MobileCommand(object): DEACTIVATE_IME_ENGINE = 'deactivateIMEEngine' GET_ACTIVE_IME_ENGINE = 'getActiveEngine' TOGGLE_LOCATION_SERVICES = 'toggleLocationServices' + TOGGLE_WIFI = 'toggleWiFi' LOCATION_IN_VIEW = 'locationInView' # Appium Commands diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index 5d171e65e..4e2043e75 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -1116,6 +1116,12 @@ def update_settings(self, settings): self.execute(Command.UPDATE_SETTINGS, data) return self + def toggle_wifi(self): + """Toggle the wifi on the device, Android only. + """ + self.execute(Command.TOGGLE_WIFI, {}) + return self + def toggle_location_services(self): """Toggle the location services on the device. Android only. """ @@ -1500,6 +1506,8 @@ def _addCommands(self): ('POST', '/session/$sessionId/appium/settings') self.command_executor._commands[Command.TOGGLE_LOCATION_SERVICES] = \ ('POST', '/session/$sessionId/appium/device/toggle_location_services') + self.command_executor._commands[Command.TOGGLE_WIFI] = \ + ('POST', '/session/$sessionId/appium/device/toggle_wifi') self.command_executor._commands[Command.SET_LOCATION] = \ ('POST', '/session/$sessionId/location') self.command_executor._commands[Command.LOCATION_IN_VIEW] = \