Skip to content

Commit e8f53c7

Browse files
committed
Support set_power_ac
1 parent 9483568 commit e8f53c7

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

appium/webdriver/extensions/power.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ def set_power_capacity(self, percent):
2929
"""
3030
self.execute(Command.SET_POWER_CAPACITY, {'percent': percent})
3131

32+
def set_power_ac(self, ac_state):
33+
"""Emulate power state change on the connected emulator.
34+
35+
:Args:
36+
- state: The power ac state to be set
37+
38+
:Usage:
39+
self.driver.set_power_state('on')
40+
self.driver.set_power_state('off')
41+
"""
42+
self.execute(Command.SET_POWER_AC, {'state': ac_state})
43+
3244
def _addCommands(self):
3345
self.command_executor._commands[Command.SET_POWER_CAPACITY] = \
3446
('POST', '/session/$sessionId/appium/device/power_capacity')
47+
self.command_executor._commands[Command.SET_POWER_AC] = \
48+
('POST', '/session/$sessionId/appium/device/power_ac')

appium/webdriver/mobilecommand.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@ class MobileCommand(object):
7878
FINGER_PRINT = 'fingerPrint'
7979
SEND_SMS = 'sendSms'
8080
SET_POWER_CAPACITY = 'setPowerCapacity'
81+
SET_POWER_AC = 'setPowerAc'

0 commit comments

Comments
 (0)