This commit is contained in:
@@ -4,6 +4,7 @@ from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
from core.errors import DeviceOfflineError, DriverError
|
||||
from core.models import ActiveApp
|
||||
from driver.base import Driver
|
||||
|
||||
|
||||
@@ -161,6 +162,19 @@ class WDADriver(Driver):
|
||||
except Exception as exc:
|
||||
raise DriverError("ui tree retrieval failed") from exc
|
||||
|
||||
def active_app(self) -> ActiveApp | None:
|
||||
client = self._require_client()
|
||||
try:
|
||||
response = client.execute_script("mobile: activeAppInfo")
|
||||
except Exception as exc:
|
||||
raise DriverError("active app retrieval failed") from exc
|
||||
if not isinstance(response, dict):
|
||||
return None
|
||||
bundle_id = response.get("bundleId")
|
||||
if not isinstance(bundle_id, str) or not bundle_id:
|
||||
return None
|
||||
return ActiveApp(platform="ios", bundle_id=bundle_id)
|
||||
|
||||
def home(self) -> None:
|
||||
client = self._require_client()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user