diff --git a/appium/webdriver/mobilecommand.py b/appium/webdriver/mobilecommand.py index 6782ddae..45a8784e 100644 --- a/appium/webdriver/mobilecommand.py +++ b/appium/webdriver/mobilecommand.py @@ -54,3 +54,6 @@ class MobileCommand(object): START_ACTIVITY = 'startActivity' GET_SETTINGS = 'getSettings' UPDATE_SETTINGS = 'updateSettings' + + #Custom + GET_SCREENSHOT = 'getScreenshot' diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index bc108288..a91c722a 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -693,6 +693,8 @@ def toggle_location_services(self): self.execute(Command.TOGGLE_LOCATION_SERVICES, {}) return self + def screenshot(self): + return self.execute(Command.GET_SCREENSHOT)['value'] def _addCommands(self): self.command_executor._commands[Command.CONTEXTS] = \ @@ -773,6 +775,10 @@ def _addCommands(self): self.command_executor._commands[Command.TOGGLE_LOCATION_SERVICES] = \ ('POST', '/session/$sessionId/appium/device/toggle_location_services') + #custom screenshot + self.command_executor._commands[Command.GET_SCREENSHOT] = \ + ('GET', '/session/$sessionId/screenshot') + # monkeypatched method for WebElement def set_value(self, value):