diff --git a/appium/webdriver/extensions/applications.py b/appium/webdriver/extensions/applications.py index a6782bfa..b5fa0fd6 100644 --- a/appium/webdriver/extensions/applications.py +++ b/appium/webdriver/extensions/applications.py @@ -31,9 +31,7 @@ def background_app(self, seconds: int) -> Self: Returns: Union['WebDriver', 'Applications']: Self instance """ - ext_name = 'mobile: backgroundApp' - args = {'seconds': seconds} - self.execute_script(ext_name, args) + self.execute_script('mobile: backgroundApp', {'seconds': seconds}) return self def is_app_installed(self, bundle_id: str) -> bool: @@ -45,9 +43,8 @@ def is_app_installed(self, bundle_id: str) -> bool: Returns: `True` if app is installed """ - ext_name = 'mobile: isAppInstalled' return self.execute_script( - ext_name, + 'mobile: isAppInstalled', { 'bundleId': bundle_id, 'appId': bundle_id, @@ -99,9 +96,8 @@ def remove_app(self, app_id: str, **options: Any) -> Self: Returns: Union['WebDriver', 'Applications']: Self instance """ - ext_name = 'mobile: removeApp' self.execute_script( - ext_name, + 'mobile: removeApp', { 'appId': app_id, 'bundleId': app_id, @@ -123,9 +119,8 @@ def terminate_app(self, app_id: str, **options: Any) -> bool: Returns: True if the app has been successfully terminated """ - ext_name = 'mobile: terminateApp' return self.execute_script( - ext_name, + 'mobile: terminateApp', { 'appId': app_id, 'bundleId': app_id, @@ -143,9 +138,8 @@ def activate_app(self, app_id: str) -> Self: Returns: Union['WebDriver', 'Applications']: Self instance """ - ext_name = 'mobile: activateApp' self.execute_script( - ext_name, + 'mobile: activateApp', { 'appId': app_id, 'bundleId': app_id, @@ -163,9 +157,8 @@ def query_app_state(self, app_id: str) -> int: One of possible application state constants. See ApplicationState class for more details. """ - ext_name = 'mobile: queryAppState' return self.execute_script( - ext_name, + 'mobile: queryAppState', { 'appId': app_id, 'bundleId': app_id, @@ -183,13 +176,12 @@ def app_strings(self, language: Union[str, None] = None, string_file: Union[str, Returns: The key is string id and the value is the content. """ - ext_name = 'mobile: getAppStrings' data = {} if language is not None: data['language'] = language if string_file is not None: data['stringFile'] = string_file - return self.execute_script(ext_name, data) + return self.execute_script('mobile: getAppStrings', data) def _add_commands(self) -> None: pass