MCPcopy Create free account
hub / github.com/appium/python-client / activate_app

Method activate_app

appium/webdriver/extensions/applications.py:175–197  ·  view source on GitHub ↗

Activates the application if it is not running or is running in the background. Args: app_id: the application id to be activated Returns: Union['WebDriver', 'Applications']: Self instance

(self, app_id: str)

Source from the content-addressed store, hash-verified

173 return self.mark_extension_absence(ext_name).execute(Command.TERMINATE_APP, data)['value']
174
175 def activate_app(self, app_id: str) -> Self:
176 """Activates the application if it is not running
177 or is running in the background.
178
179 Args:
180 app_id: the application id to be activated
181
182 Returns:
183 Union['WebDriver', 'Applications']: Self instance
184 """
185 ext_name = 'mobile: activateApp'
186 try:
187 self.assert_extension_exists(ext_name).execute_script(
188 ext_name,
189 {
190 'appId': app_id,
191 'bundleId': app_id,
192 },
193 )
194 except (UnknownMethodException, InvalidArgumentException):
195 # TODO: Remove the fallback
196 self.mark_extension_absence(ext_name).execute(Command.ACTIVATE_APP, {'appId': app_id})
197 return self
198
199 def query_app_state(self, app_id: str) -> int:
200 """Queries the state of the application.

Callers 2

test_activate_appFunction · 0.80
driverFunction · 0.80

Calls 4

execute_scriptMethod · 0.80
executeMethod · 0.45

Tested by 2

test_activate_appFunction · 0.64
driverFunction · 0.64