Skip to content
22 changes: 7 additions & 15 deletions appium/webdriver/extensions/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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
Loading