appium-connect-agent 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- appium_connect_agent/__init__.py +1 -0
- appium_connect_agent/automation/__init__.py +64 -0
- appium_connect_agent/automation/_actions.py +94 -0
- appium_connect_agent/automation/_boolean_value.py +11 -0
- appium_connect_agent/automation/_device.py +947 -0
- appium_connect_agent/automation/_discovery.py +786 -0
- appium_connect_agent/automation/_editor_action.py +116 -0
- appium_connect_agent/automation/_element.py +656 -0
- appium_connect_agent/automation/_element_target.py +438 -0
- appium_connect_agent/automation/_gestures.py +402 -0
- appium_connect_agent/automation/_ios_actions.py +380 -0
- appium_connect_agent/automation/_ios_privacy.py +46 -0
- appium_connect_agent/automation/_macos_actions.py +490 -0
- appium_connect_agent/automation/_macos_keyboard.py +18 -0
- appium_connect_agent/automation/_models.py +415 -0
- appium_connect_agent/automation/_observation.py +1966 -0
- appium_connect_agent/automation/_session.py +3005 -0
- appium_connect_agent/automation/_session_client.py +180 -0
- appium_connect_agent/automation/_session_coordination.py +194 -0
- appium_connect_agent/automation/_system_actions.py +802 -0
- appium_connect_agent/automation/_text_actions.py +104 -0
- appium_connect_agent/automation/_visual.py +475 -0
- appium_connect_agent/configuration/__init__.py +7 -0
- appium_connect_agent/configuration/_loader.py +475 -0
- appium_connect_agent/configuration/_models.py +46 -0
- appium_connect_agent/contracts/__init__.py +78 -0
- appium_connect_agent/contracts/_url.py +67 -0
- appium_connect_agent/integrations/__init__.py +58 -0
- appium_connect_agent/integrations/_application.py +2346 -0
- appium_connect_agent/integrations/_bridge.py +277 -0
- appium_connect_agent/integrations/_catalog.py +852 -0
- appium_connect_agent/integrations/_cli_protocol.py +236 -0
- appium_connect_agent/integrations/_daemon.py +307 -0
- appium_connect_agent/integrations/_endpoint.py +260 -0
- appium_connect_agent/integrations/_models.py +2396 -0
- appium_connect_agent/integrations/_server.py +211 -0
- appium_connect_agent/integrations/_toolcall.py +179 -0
- appium_connect_agent/integrations/cli.py +546 -0
- appium_connect_agent/py.typed +0 -0
- appium_connect_agent/runtime/__init__.py +77 -0
- appium_connect_agent/runtime/_connection.py +323 -0
- appium_connect_agent/runtime/_coordination.py +89 -0
- appium_connect_agent/runtime/_diagnostics.py +959 -0
- appium_connect_agent/runtime/_http.py +212 -0
- appium_connect_agent/runtime/_inspection.py +210 -0
- appium_connect_agent/runtime/_installation.py +1604 -0
- appium_connect_agent/runtime/_maintenance.py +916 -0
- appium_connect_agent/runtime/_managed.py +1104 -0
- appium_connect_agent/runtime/_models.py +242 -0
- appium_connect_agent/runtime/_semver.py +52 -0
- appium_connect_agent-0.1.0.dist-info/METADATA +760 -0
- appium_connect_agent-0.1.0.dist-info/RECORD +55 -0
- appium_connect_agent-0.1.0.dist-info/WHEEL +4 -0
- appium_connect_agent-0.1.0.dist-info/entry_points.txt +4 -0
- appium_connect_agent-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Python package foundation for Appium agent integration."""
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Synchronous device discovery, Sessions, bound Element and Device operations."""
|
|
2
|
+
|
|
3
|
+
from ._device import Device as Device
|
|
4
|
+
from ._discovery import list_devices as list_devices
|
|
5
|
+
from ._discovery import list_ios_devices as list_ios_devices
|
|
6
|
+
from ._element import Element as Element
|
|
7
|
+
from ._element import ElementValidationError as ElementValidationError
|
|
8
|
+
from ._macos_keyboard import MACOS_MODIFIER_CAPS_LOCK as MACOS_MODIFIER_CAPS_LOCK
|
|
9
|
+
from ._macos_keyboard import MACOS_MODIFIER_COMMAND as MACOS_MODIFIER_COMMAND
|
|
10
|
+
from ._macos_keyboard import MACOS_MODIFIER_CONTROL as MACOS_MODIFIER_CONTROL
|
|
11
|
+
from ._macos_keyboard import MACOS_MODIFIER_FUNCTION as MACOS_MODIFIER_FUNCTION
|
|
12
|
+
from ._macos_keyboard import MACOS_MODIFIER_OPTION as MACOS_MODIFIER_OPTION
|
|
13
|
+
from ._macos_keyboard import MACOS_MODIFIER_SHIFT as MACOS_MODIFIER_SHIFT
|
|
14
|
+
from ._macos_keyboard import MacKeyStroke as MacKeyStroke
|
|
15
|
+
from ._models import AttributeObservation as AttributeObservation
|
|
16
|
+
from ._models import AutomationError as AutomationError
|
|
17
|
+
from ._models import AutomationPlatform as AutomationPlatform
|
|
18
|
+
from ._models import Bounds as Bounds
|
|
19
|
+
from ._models import CommandError as CommandError
|
|
20
|
+
from ._models import Coverage as Coverage
|
|
21
|
+
from ._models import DeviceInfo as DeviceInfo
|
|
22
|
+
from ._models import DeviceTime as DeviceTime
|
|
23
|
+
from ._models import DeviceWeekday as DeviceWeekday
|
|
24
|
+
from ._models import DisplaySize as DisplaySize
|
|
25
|
+
from ._models import ElementAttribute as ElementAttribute
|
|
26
|
+
from ._models import ElementBy as ElementBy
|
|
27
|
+
from ._models import ElementInspection as ElementInspection
|
|
28
|
+
from ._models import ExecutionUnknownError as ExecutionUnknownError
|
|
29
|
+
from ._models import ImageRegion as ImageRegion
|
|
30
|
+
from ._models import InvalidRequestError as InvalidRequestError
|
|
31
|
+
from ._models import InvalidSessionStateError as InvalidSessionStateError
|
|
32
|
+
from ._models import IosDeviceInfo as IosDeviceInfo
|
|
33
|
+
from ._models import IosDeviceKind as IosDeviceKind
|
|
34
|
+
from ._models import IosDeviceState as IosDeviceState
|
|
35
|
+
from ._models import LocatorValue as LocatorValue
|
|
36
|
+
from ._models import ObservationScope as ObservationScope
|
|
37
|
+
from ._models import ObservedValue as ObservedValue
|
|
38
|
+
from ._models import OperationCancelledError as OperationCancelledError
|
|
39
|
+
from ._models import OperationTimeoutError as OperationTimeoutError
|
|
40
|
+
from ._models import Point as Point
|
|
41
|
+
from ._models import RawNode as RawNode
|
|
42
|
+
from ._models import RawStructureObservation as RawStructureObservation
|
|
43
|
+
from ._models import ResourceStateError as ResourceStateError
|
|
44
|
+
from ._models import SessionBusyError as SessionBusyError
|
|
45
|
+
from ._models import SessionInfo as SessionInfo
|
|
46
|
+
from ._models import SourceMetadata as SourceMetadata
|
|
47
|
+
from ._models import TargetError as TargetError
|
|
48
|
+
from ._models import TreeNode as TreeNode
|
|
49
|
+
from ._models import TreeObservation as TreeObservation
|
|
50
|
+
from ._models import ValueState as ValueState
|
|
51
|
+
from ._models import Viewport as Viewport
|
|
52
|
+
from ._models import ViewportRelation as ViewportRelation
|
|
53
|
+
from ._models import Visibility as Visibility
|
|
54
|
+
from ._models import VisualImageMatch as VisualImageMatch
|
|
55
|
+
from ._models import VisualInspection as VisualInspection
|
|
56
|
+
from ._models import VisualMode as VisualMode
|
|
57
|
+
from ._models import VisualProvider as VisualProvider
|
|
58
|
+
from ._models import VisualProviderRequest as VisualProviderRequest
|
|
59
|
+
from ._models import VisualProviderResponse as VisualProviderResponse
|
|
60
|
+
from ._models import VisualTargetCandidate as VisualTargetCandidate
|
|
61
|
+
from ._session import Session as Session
|
|
62
|
+
from ._session import create_mac2_session as create_mac2_session
|
|
63
|
+
from ._session import create_session as create_session
|
|
64
|
+
from ._session import create_xcuitest_session as create_xcuitest_session
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Bounded Element click actions for the qualified Android platform."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import time
|
|
6
|
+
from typing import TYPE_CHECKING, ClassVar, Literal
|
|
7
|
+
|
|
8
|
+
from appium.webdriver.webdriver import WebDriver
|
|
9
|
+
from selenium.webdriver.remote.webelement import WebElement
|
|
10
|
+
|
|
11
|
+
from ._element import Element
|
|
12
|
+
from ._element_target import _wait_for_ready_element, _with_raw_id_guard
|
|
13
|
+
from ._models import InvalidRequestError, OperationTimeoutError
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
from ._session import _SessionOperationGateway
|
|
17
|
+
|
|
18
|
+
_ActionKind = Literal["single", "double", "long"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class _InvalidActionResponse(Exception):
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class _AndroidElementActions:
|
|
26
|
+
_SCRIPTS: ClassVar[dict[_ActionKind, str]] = {
|
|
27
|
+
"single": "mobile: clickGesture",
|
|
28
|
+
"double": "mobile: doubleClickGesture",
|
|
29
|
+
"long": "mobile: longClickGesture",
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def perform(
|
|
33
|
+
self,
|
|
34
|
+
driver: WebDriver,
|
|
35
|
+
target: WebElement,
|
|
36
|
+
*,
|
|
37
|
+
kind: _ActionKind,
|
|
38
|
+
duration_ms: int | None,
|
|
39
|
+
) -> None:
|
|
40
|
+
payload: dict[str, str | int] = {"elementId": target.id}
|
|
41
|
+
if kind == "long":
|
|
42
|
+
if duration_ms is None:
|
|
43
|
+
raise RuntimeError("long click requires a normalized duration")
|
|
44
|
+
payload["duration"] = duration_ms
|
|
45
|
+
result = driver.execute_script(self._SCRIPTS[kind], payload)
|
|
46
|
+
if result is not None:
|
|
47
|
+
raise _InvalidActionResponse
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
_ANDROID_ACTIONS = _AndroidElementActions()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _validate_duration(value: object, operation_id: str) -> int:
|
|
54
|
+
if type(value) is not int or not 1 <= value <= 60_000:
|
|
55
|
+
raise InvalidRequestError("invalid_argument", operation_id, "not_sent")
|
|
56
|
+
return value
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _perform_action(
|
|
60
|
+
driver: WebDriver,
|
|
61
|
+
element: Element,
|
|
62
|
+
gateway: _SessionOperationGateway,
|
|
63
|
+
*,
|
|
64
|
+
kind: _ActionKind,
|
|
65
|
+
duration_ms: int | None,
|
|
66
|
+
condition_deadline: float,
|
|
67
|
+
) -> None:
|
|
68
|
+
def guarded_action() -> None:
|
|
69
|
+
target = _wait_for_ready_element(driver, element, gateway, condition_deadline)
|
|
70
|
+
gateway.checkpoint()
|
|
71
|
+
operation_deadline = gateway.operation_deadline
|
|
72
|
+
if (
|
|
73
|
+
duration_ms is not None
|
|
74
|
+
and operation_deadline is not None
|
|
75
|
+
and duration_ms / 1000.0 >= operation_deadline - time.monotonic()
|
|
76
|
+
):
|
|
77
|
+
gateway.checkpoint()
|
|
78
|
+
raise OperationTimeoutError(
|
|
79
|
+
"operation_timeout",
|
|
80
|
+
gateway.operation_id,
|
|
81
|
+
"not_sent",
|
|
82
|
+
completed_steps=gateway.completed_steps,
|
|
83
|
+
)
|
|
84
|
+
gateway.final_action(
|
|
85
|
+
lambda: _ANDROID_ACTIONS.perform(
|
|
86
|
+
driver,
|
|
87
|
+
target,
|
|
88
|
+
kind=kind,
|
|
89
|
+
duration_ms=duration_ms,
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
gateway.complete("action_completed")
|
|
93
|
+
|
|
94
|
+
_with_raw_id_guard(driver, (element,), gateway, guarded_action)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Narrow shared normalization for Android boolean attribute values."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def _parse_boolean_value(value: object) -> bool:
|
|
5
|
+
if isinstance(value, bool):
|
|
6
|
+
return value
|
|
7
|
+
if isinstance(value, str):
|
|
8
|
+
normalized = value.lower()
|
|
9
|
+
if normalized in {"true", "false"}:
|
|
10
|
+
return normalized == "true"
|
|
11
|
+
raise ValueError("invalid boolean attribute value")
|