Skip to content

Commit b6bdf5f

Browse files
joshuasince1986KazuCocoa
authored andcommitted
add toggle wifi command (#241)
* add toggle_wifi command * update comment to indicate toggle_wifi is only for Android
1 parent 8a3ac84 commit b6bdf5f

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

appium/webdriver/mobilecommand.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class MobileCommand(object):
2828
DEACTIVATE_IME_ENGINE = 'deactivateIMEEngine'
2929
GET_ACTIVE_IME_ENGINE = 'getActiveEngine'
3030
TOGGLE_LOCATION_SERVICES = 'toggleLocationServices'
31+
TOGGLE_WIFI = 'toggleWiFi'
3132
LOCATION_IN_VIEW = 'locationInView'
3233

3334
# Appium Commands

appium/webdriver/webdriver.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,12 @@ def update_settings(self, settings):
11161116
self.execute(Command.UPDATE_SETTINGS, data)
11171117
return self
11181118

1119+
def toggle_wifi(self):
1120+
"""Toggle the wifi on the device, Android only.
1121+
"""
1122+
self.execute(Command.TOGGLE_WIFI, {})
1123+
return self
1124+
11191125
def toggle_location_services(self):
11201126
"""Toggle the location services on the device. Android only.
11211127
"""
@@ -1500,6 +1506,8 @@ def _addCommands(self):
15001506
('POST', '/session/$sessionId/appium/settings')
15011507
self.command_executor._commands[Command.TOGGLE_LOCATION_SERVICES] = \
15021508
('POST', '/session/$sessionId/appium/device/toggle_location_services')
1509+
self.command_executor._commands[Command.TOGGLE_WIFI] = \
1510+
('POST', '/session/$sessionId/appium/device/toggle_wifi')
15031511
self.command_executor._commands[Command.SET_LOCATION] = \
15041512
('POST', '/session/$sessionId/location')
15051513
self.command_executor._commands[Command.LOCATION_IN_VIEW] = \

0 commit comments

Comments
 (0)