diff --git a/AppiumLibrary/keywords/_applicationmanagement.py b/AppiumLibrary/keywords/_applicationmanagement.py index 3075e6c..5ec3f40 100644 --- a/AppiumLibrary/keywords/_applicationmanagement.py +++ b/AppiumLibrary/keywords/_applicationmanagement.py @@ -439,6 +439,26 @@ def get_device_time(self, format: Optional[str] = None): """ return self._current_application().get_device_time(format) + def get_clipboard_text(self): + """Returns the current text content from the system clipboard. + + Supports Android and iOS (XCUITest). + Note: On iOS 13+ real devices, WebDriverAgentRunner must be in the foreground to get clipboard content, + otherwise an empty string may be returned. + """ + return self._current_application().get_clipboard_text() + + def set_clipboard_text(self, text): + """Sets the given text into the system clipboard. + + Supports Android and iOS (XCUITest). + Note: On iOS 15+ real devices, WebDriverAgentRunner must be in the foreground to set clipboard content. + + Args: + - ``text`` - text to place on the clipboard + """ + self._current_application().set_clipboard_text(text) + def get_device_location(self): """Gets the device's current GPS location with human-readable address information.