🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
Python aiai-scrapingautomationcrawlercrawlingcrawling-pythondatadata-extractionmcpmcp-serverplaywrightpythonscrapingselectorsstealthweb-scraperweb-scrapingweb-scraping-pythonwebscrapingxpath
perf(mcp)!: Combine `selector` and `ref` into one field called `target`
Karim shoair1c3e355c9f7b
diff --git a/agent-skill/Scrapling-Skill/references/mcp-server.md b/agent-skill/Scrapling-Skill/references/mcp-server.mdindex c0e1569..9714b79 100644--- a/agent-skill/Scrapling-Skill/references/mcp-server.md+++ b/agent-skill/Scrapling-Skill/references/mcp-server.md@@ -162,10 +162,10 @@ Runs actions in order on the existing page in a stealthy browser session. Call `| `combobox` | Target, `value`, `timeout=30000` | Select native `<select>` options by label; use a string, a list of strings for multiple selections, or `[]` to clear || `press_key` | `key` | Press a nonempty native key name, character, or shortcut at the current focus || `wait_time` | `milliseconds` | Fixed pause in finite nonnegative milliseconds |-| `wait_element` | `selector`, `state="visible"`, `timeout=30000` | Wait for a nonempty Playwright selector to reach `"visible"`, `"hidden"`, `"attached"`, or `"detached"` |+| `wait_element` | `target`, `state="visible"`, `timeout=30000` | Wait for an element to reach `"visible"`, `"hidden"`, `"attached"`, or `"detached"` || `wait_load` | `state`, `timeout=30000` | Wait for `"domcontentloaded"`, `"load"`, or `"networkidle"` |-**Targets and timing.** Each move or click needs exactly one target: a nonempty Playwright `selector`, a nonempty snapshot `ref` such as `"e2"`, or both `x` and `y`. Coordinates must be finite viewport CSS pixels from the main frame's top-left, not full-page screenshot coordinates. Field actions need exactly one nonempty `selector` or `ref` and can target fields anywhere on the page without a `<form>` parent. Element waits use a selector only. Mouse and field selectors must match exactly one element. Use current snapshot references; do not build a chain with references that need a future snapshot.+**Targets and timing.** Element actions use a nonempty `target`: a Playwright selector such as `"#search"` or a snapshot reference as `"aria-ref=e2"`. Bare reference strings such as `"e2"` are treated as selectors. Each move or click needs either `target` or both `x` and `y`. Coordinates must be finite viewport CSS pixels from the main frame's top-left, not full-page screenshot coordinates. Field actions need `target` and can target fields anywhere on the page without a `<form>` parent. Element waits also use `target`. Mouse and field targets must match exactly one element. Use current snapshot references; do not build a chain with references that need a future snapshot.Each action with a `timeout` accepts finite nonnegative milliseconds, default 30000; 0 disables the limit. Mouse coordinate actions ignore it. For text input, the limit applies separately to each native operation, including clearing and each character press in slow mode. Keyboard, wheel, and fixed-pause actions have no timeout option. Pauses between actions are outside action timeouts.@@ -183,10 +183,10 @@ For example, fill and submit a search, wait for its results, then hover over the{"session_id": "browser","actions": [- {"type": "textbox", "selector": "#search", "value": "books"},+ {"type": "textbox", "target": "#search", "value": "books"},{"type": "press_key", "key": "Enter"},- {"type": "wait_element", "selector": "#results"},- {"type": "move", "selector": "#results"},+ {"type": "wait_element", "target": "#results"},+ {"type": "move", "target": "#results"},{"type": "wheel", "delta_y": 500}]}diff --git a/docs/api-reference/mcp-server.md b/docs/api-reference/mcp-server.mdindex 01c5b15..7d09377 100644--- a/docs/api-reference/mcp-server.md+++ b/docs/api-reference/mcp-server.md@@ -84,7 +84,7 @@ The main MCP server class that provides all web scraping tools:Target fields anywhere on the page through selectors or snapshot references. Fill text, check or uncheck boxes, select radio buttons, and choose one or more native dropdown options by label. Replace or clear text, or type at the current caret. Keyboard shortcuts use the current focus. Slow mode adds random pauses between typed characters and all actions.- Wait for content, loading overlays, page load events, or settled network activity, or add a fixed pause before continuing.+ Wait for content or loading overlays through selectors or snapshot references, wait for page load events or settled network activity, or add a fixed pause before continuing.- **`browser_evaluate`**: Run JavaScript on the current page to extract custom data, calculate results, read application state, or update page content. Supports asynchronous scripts and returns their results as JSON.- **`browser_network_requests`**: Search completed browser requests across tabs, navigation, and actions. Find API calls, HTTP errors, and saved redirects, with static resources hidden by default for smaller results. Failed and unfinished requests are omitted. Returns structured request details with pagination.diff --git a/scrapling/core/ai/_browser_actions.py b/scrapling/core/ai/_browser_actions.pyindex 763bbf9..a8a18e7 100644--- a/scrapling/core/ai/_browser_actions.py+++ b/scrapling/core/ai/_browser_actions.py@@ -21,8 +21,13 @@ from scrapling.core._types import (MouseButton = Literal["left", "right", "middle"]NonNegativeFiniteFloat = Annotated[float, Field(ge=0, allow_inf_nan=False)]NonEmptyString = Annotated[str, Field(min_length=1)]-_Selector = TypeAliasType("_Selector", Annotated[Optional[NonEmptyString], Field(title="Selector")])-_Ref = TypeAliasType("_Ref", Annotated[Optional[NonEmptyString], Field(title="Ref")])+_Target = TypeAliasType(+ "_Target",+ Annotated[+ Optional[NonEmptyString],+ Field(title="Target", description="Playwright selector or snapshot ref as aria-ref=<ref>."),+ ],+)_FieldTimeout = TypeAliasType("_FieldTimeout",Annotated[@@ -32,12 +37,11 @@ _FieldTimeout = TypeAliasType(class _MouseTarget(TypedDict, total=False):- selector: _Selector- ref: _Ref+ target: _Targetx: Optional[FiniteFloat]y: Optional[FiniteFloat]timeout: Annotated[- NonNegativeFiniteFloat, Field(default=30000, description="Selector/ref timeout in ms; 0 disables it.")+ NonNegativeFiniteFloat, Field(default=30000, description="Element timeout in ms; 0 disables it.")]@@ -76,7 +80,7 @@ class _ConditionWait(TypedDict, total=False):class _ElementWait(_ConditionWait):type: Literal["wait_element"]- selector: Annotated[NonEmptyString, Field(description="Playwright selector for one element.")]+ target: Annotated[NonEmptyString, Field(description="Playwright selector or aria-ref=<ref> for one element.")]state: NotRequired[Annotated[SelectorWaitStates, Field(default="visible", description="Hidden includes removal.")]]@@ -96,8 +100,7 @@ class _KeyPress(TypedDict):class _FormTarget(TypedDict, total=False):- selector: _Selector- ref: _Ref+ target: _Targettimeout: Annotated[_FieldTimeout, Field(default=30000)]@@ -146,16 +149,12 @@ def _validate_actions(actions: List[BrowserAction]) -> None:"""Validate every action target before reserving the page."""for index, action in enumerate(actions, 1):if action["type"] in ("move", "click") and (- sum(action.get(key) is not None for key in ("selector", "ref", "x")) != 1+ (action.get("target") is None) == (action.get("x") is None)or (action.get("x") is None) != (action.get("y") is None)):- raise ValueError(- f"Action {index} ({action['type']}) needs exactly one target: 'selector', 'ref', or both 'x' and 'y'."- )- if action["type"] in ("textbox", "checkbox", "radio", "combobox") and (- (action.get("selector") is None) == (action.get("ref") is None)- ):- raise ValueError(f"Action {index} ({action['type']}) needs exactly one target: 'selector' or 'ref'.")+ raise ValueError(f"Action {index} ({action['type']}) needs 'target' or both 'x' and 'y', not both.")+ if action["type"] in ("textbox", "checkbox", "radio", "combobox") and action.get("target") is None:+ raise ValueError(f"Action {index} ({action['type']}) needs 'target'.")async def _run_actions(page: Any, actions: List[BrowserAction], slowly: bool = False) -> None:@@ -167,7 +166,7 @@ async def _run_actions(page: Any, actions: List[BrowserAction], slowly: bool = Fif action["type"] == "wait_time":await page.wait_for_timeout(action["milliseconds"])elif action["type"] == "wait_element":- await page.locator(action["selector"]).wait_for(+ await page.locator(action["target"]).wait_for(state=action.get("state", "visible"), timeout=action.get("timeout", 30000))elif action["type"] == "wait_load":@@ -177,12 +176,10 @@ async def _run_actions(page: Any, actions: List[BrowserAction], slowly: bool = Felif action["type"] == "wheel":await page.mouse.wheel(action.get("delta_x", 0), action.get("delta_y", 0))else:- selector, ref = action.get("selector"), action.get("ref")+ target = action.get("target")timeout = action.get("timeout", 30000)if action["type"] == "move" or action["type"] == "click":- locator = (- page.locator(selector or f"aria-ref={ref}") if selector is not None or ref is not None else None- )+ locator = page.locator(target) if target is not None else Noneif action["type"] == "move":if locator is not None:await locator.hover(timeout=timeout)@@ -208,7 +205,7 @@ async def _run_actions(page: Any, actions: List[BrowserAction], slowly: bool = Fraise exc from cleanup_errorraiseelse:- locator = page.locator(selector or f"aria-ref={ref}")+ locator = page.locator(target)if action["type"] == "textbox":if action.get("clear", True):await locator.fill("" if slowly else action["value"], timeout=timeout)diff --git a/scrapling/core/ai/server.py b/scrapling/core/ai/server.pyindex 62a3a48..df959d2 100644--- a/scrapling/core/ai/server.py+++ b/scrapling/core/ai/server.py@@ -481,7 +481,7 @@ class ScraplingMCPServer:Cancelled/timed-out clicks attempt button release. Load waits observe the current document, not future navigation.:param session_id: ID from `browser_open`; call `browser_fetch` first.- :param actions: Ordered actions; fields need one selector/ref, mouse targets one selector/ref or viewport (x, y).+ :param actions: Ordered actions; fields need target; mouse needs target or viewport (x, y).:param slowly: Fresh random delays: 50-150 ms per character, 100-300 ms between all actions, including waits."""_validate_actions(actions)@@ -894,7 +894,7 @@ class ScraplingMCPServer:5. Session options persist from opening; fetch options apply per call, with schema defaults.6. Each browser session uses one page; finish each call before starting the next in that session.7. Snapshots include refs and boxes by default; `main_content_only` and `pierce_shadow` do not filter them.-8. `browser_actions` chains mouse, field, key and wait actions on the current page. Move/click needs one selector, current snapshot ref, or viewport (x, y) in CSS pixels; fields need one selector/ref. Wheel uses the current pointer without waiting for scrolling; coordinate clicks do not wait for navigation. Load waits observe the current document; wait for a result element for delayed navigation.+8. `browser_actions` chains mouse, field, key and wait actions on the current page. Element actions use `target`: a Playwright selector or `aria-ref=<ref>` from the current snapshot. Move/click can instead use viewport (x, y) in CSS pixels. Wheel uses the current pointer without waiting for scrolling; coordinate clicks do not wait for navigation. Load waits observe the current document; wait for a result element for delayed navigation.9. Network history saves completed requests and responses across page changes. Failed/unfinished requests are omitted; closing does not wait for running captures. Use `include_static=True` to list successful non-API traffic. Limits: 1000 requests and 20 MiB of saved response bodies; oldest records are removed first. Only response bodies with a text Content-Type are read and saved. Response bodies over 1 MiB are skipped; unavailable bodies are marked.""",}if self._auth_token:diff --git a/tests/ai/test_browser_actions.py b/tests/ai/test_browser_actions.pyindex 0e1299d..5765aa7 100644--- a/tests/ai/test_browser_actions.py+++ b/tests/ai/test_browser_actions.py@@ -62,11 +62,11 @@ async def test_mixed_actions_keep_order_and_sample_each_delay(slowly: bool, monk"session_id": "browser","slowly": slowly,"actions": [- {"type": "textbox", "selector": "#name", "value": "ab", "timeout": 17},+ {"type": "textbox", "target": "#name", "value": "ab", "timeout": 17},{"type": "press_key", "key": "Tab"},{"type": "wait_time", "milliseconds": 12},{"type": "wheel", "delta_y": 4},- {"type": "wait_element", "selector": "#ready", "timeout": 23},+ {"type": "wait_element", "target": "#ready", "timeout": 23},{"type": "wait_load", "state": "load", "timeout": 31},],},@@ -99,11 +99,11 @@ async def test_mixed_actions_keep_order_and_sample_each_delay(slowly: bool, monk@pytest.mark.parametrize("invalid",[- {"type": "textbox", "selector": "#name", "ref": "e1", "value": "bad"},+ {"type": "textbox", "target": None, "value": "bad"},{"type": "click", "x": 10},- {"type": "combobox", "selector": "#kind", "value": {}},+ {"type": "combobox", "target": "#kind", "value": {}},{"type": "press_key", "key": ""},- {"type": "wait_element", "selector": "#ready", "timeout": -1},+ {"type": "wait_element", "target": "#ready", "timeout": -1},],)async def test_invalid_later_action_prevents_other_action_kinds(invalid: dict[str, Any]) -> None:@@ -115,7 +115,7 @@ async def test_invalid_later_action_prevents_other_action_kinds(invalid: dict[st"session_id": "browser","actions": [{"type": "wait_time", "milliseconds": 0},- {"type": "textbox", "selector": "#name", "value": "unchanged"},+ {"type": "textbox", "target": "#name", "value": "unchanged"},invalid,{"type": "press_key", "key": "Enter"},],@@ -168,15 +168,15 @@ async def test_live_mixed_chain_resolves_targets_created_by_earlier_actions(slow"session_id": "browser","slowly": slowly,"actions": [- {"type": "textbox", "ref": ref[1], "value": "Scrapling"},+ {"type": "textbox", "target": f"aria-ref={ref[1]}", "value": "Scrapling"},{"type": "press_key", "key": "Enter"},- {"type": "wait_element", "selector": "#result", "timeout": 5000},- {"type": "wait_element", "selector": "#loading", "state": "hidden", "timeout": 5000},- {"type": "move", "selector": "#result", "timeout": 5000},- {"type": "click", "selector": "#choose", "timeout": 5000},- {"type": "textbox", "selector": "#note", "value": "Done", "timeout": 5000},- {"type": "checkbox", "selector": "#agree", "value": True, "timeout": 5000},- {"type": "combobox", "selector": "#kind", "value": "B", "timeout": 5000},+ {"type": "wait_element", "target": "#result", "timeout": 5000},+ {"type": "wait_element", "target": "#loading", "state": "hidden", "timeout": 5000},+ {"type": "move", "target": "#result", "timeout": 5000},+ {"type": "click", "target": "#choose", "timeout": 5000},+ {"type": "textbox", "target": "#note", "value": "Done", "timeout": 5000},+ {"type": "checkbox", "target": "#agree", "value": True, "timeout": 5000},+ {"type": "combobox", "target": "#kind", "value": "B", "timeout": 5000},],},)@@ -189,7 +189,8 @@ async def test_live_mixed_chain_resolves_targets_created_by_earlier_actions(slow@pytest.mark.asyncio-async def test_live_stale_ref_stops_mixed_chain_without_retargeting() -> None:[email protected]("kind", ["textbox", "move", "click", "wait_element"])+async def test_live_stale_ref_stops_mixed_chain_without_retargeting(kind: str) -> None:async with _browser() as (client, session, page):await page.set_content("""<label>Old<input id=field value=old></label><button id=replace>Replace</button><script>@@ -206,13 +207,50 @@ async def test_live_stale_ref_stops_mixed_chain_without_retargeting() -> None:{"session_id": "browser","actions": [- {"type": "click", "selector": "#replace"},- {"type": "textbox", "ref": ref[1], "value": "wrong", "timeout": 100},- {"type": "textbox", "selector": "#field", "value": "skipped"},+ {"type": "click", "target": "#replace"},+ {+ "type": kind,+ "target": f"aria-ref={ref[1]}",+ "timeout": 100,+ **({"value": "wrong"} if kind == "textbox" else {}),+ },+ {"type": "textbox", "target": "#field", "value": "skipped"},],},)assert result.is_error and isinstance(result.content[0], TextContent)- assert "Action 2 (textbox) failed:" in result.content[0].text+ assert f"Action 2 ({kind}) failed:" in result.content[0].textassert await page.locator("#field").input_value() == "new"assert session.page_pool.pages[0].state == "ready"++[email protected]("use_ref", [False, True])+async def test_live_targets_keep_explicit_refs_and_ref_shaped_selectors_distinct(use_ref: bool) -> None:+ async with _browser() as (client, session, page):+ await page.set_content("""<e12 role=textbox aria-label=Literal contenteditable=true+ style="display:block;width:200px;height:50px"+ onmouseenter="this.dataset.hovered='yes'" onclick="this.dataset.clicked='yes'">initial</e12>""")+ snapshot = await client.call_tool("browser_snapshot", {"session_id": "browser"})+ assert not snapshot.is_error and isinstance(snapshot.content[0], TextContent)+ ref = search(r'textbox "Literal".*?\[ref=([^\]]+)\]', snapshot.content[0].text)+ assert ref is not None+ target = f"aria-ref={ref[1]}" if use_ref else "e12"+ result = await client.call_tool(+ "browser_actions",+ {+ "session_id": "browser",+ "actions": [+ {"type": "wait_element", "target": target, "timeout": 1000},+ {"type": "move", "target": target, "timeout": 1000},+ {"type": "textbox", "target": target, "value": "changed", "timeout": 1000},+ {"type": "click", "target": target, "timeout": 1000},+ ],+ },+ )+ assert not result.is_error+ element = page.locator("e12")+ assert await element.text_content() == "changed"+ assert await element.get_attribute("data-hovered") == "yes"+ assert await element.get_attribute("data-clicked") == "yes"+ assert session.page_pool.pages[0].state == "ready"diff --git a/tests/ai/test_browser_evaluate.py b/tests/ai/test_browser_evaluate.pyindex a2e8729..924b7b8 100644--- a/tests/ai/test_browser_evaluate.py+++ b/tests/ai/test_browser_evaluate.py@@ -284,10 +284,10 @@ async def test_browser_evaluate_live_expressions_promises_context_and_page_state{"session_id": "browser","actions": [- {"type": "textbox", "selector": "#name", "value": "before"},- {"type": "checkbox", "selector": "#agree", "value": True},- {"type": "click", "selector": "#toggle"},- {"type": "click", "selector": "#name"},+ {"type": "textbox", "target": "#name", "value": "before"},+ {"type": "checkbox", "target": "#agree", "value": True},+ {"type": "click", "target": "#toggle"},+ {"type": "click", "target": "#name"},],},)diff --git a/tests/ai/test_browser_fill_fields.py b/tests/ai/test_browser_fill_fields.pyindex 3214c3b..1b2b234 100644--- a/tests/ai/test_browser_fill_fields.py+++ b/tests/ai/test_browser_fill_fields.py@@ -18,7 +18,7 @@ from scrapling.core._types import Any, AsyncGeneratorfrom scrapling.engines._browsers._base import AsyncSession-TEXT_FIELD = {"type": "textbox", "selector": "#name", "value": "private value"}+TEXT_FIELD = {"type": "textbox", "target": "#name", "value": "private value"}HTML = """<!DOCTYPE html><html><body><form><label>Name<input id="name" value="initial"></label><label>Notes<textarea id="notes">initial notes</textarea></label><div id="editor" contenteditable="true">initial editor</div>@@ -87,7 +87,7 @@ async def test_browser_actions_fields_schema() -> None:for kind in ("textbox", "checkbox", "radio", "combobox"):variant = variants[kind]assert set(variant["required"]) == {"type", "value"}- assert set(variant["properties"]) == {"type", "value", "selector", "ref", "timeout"} | (+ assert set(variant["properties"]) == {"type", "value", "target", "timeout"} | ({"clear"} if kind == "textbox" else set())assert variant["properties"]["type"]["const"] == kind@@ -99,12 +99,12 @@ async def test_browser_actions_fields_schema() -> None:"title": "Timeout","type": "number",}- for target in ("selector", "ref"):- reference = variant["properties"][target]["$ref"]- assert schema["$defs"][reference.rsplit("/", 1)[1]] == {- "anyOf": [{"minLength": 1, "type": "string"}, {"type": "null"}],- "title": target.title(),- }+ assert variant["properties"]["target"] == {"$ref": "#/$defs/_Target"}+ assert schema["$defs"]["_Target"] == {+ "anyOf": [{"minLength": 1, "type": "string"}, {"type": "null"}],+ "description": "Playwright selector or snapshot ref as aria-ref=<ref>.",+ "title": "Target",+ }assert variants["textbox"]["properties"]["value"]["type"] == "string"assert variants["textbox"]["properties"]["clear"]["type"] == "boolean"assert variants["textbox"]["properties"]["clear"]["default"] is True@@ -122,15 +122,15 @@ async def test_browser_actions_fields_forwards_native_actions_in_order(pause = AsyncMock()monkeypatch.setattr("scrapling.core.ai._browser_actions.sleep", pause)actions = [- {**TEXT_FIELD, "ref": None},- {"type": "textbox", "selector": None, "ref": "e2", "value": "", "clear": True},- {"type": "checkbox", "selector": "#agree", "value": True},- {"type": "checkbox", "selector": "#agree", "value": False},- {"type": "checkbox", "selector": "#agree", "value": "false"},- {"type": "radio", "selector": "#pro", "value": True},- {"type": "combobox", "selector": "#country", "value": "United Kingdom"},- {"type": "combobox", "selector": "#colors", "value": ["Red", "Blue"]},- {"type": "combobox", "selector": "#colors", "value": []},+ TEXT_FIELD,+ {"type": "textbox", "target": "aria-ref=e2", "value": "", "clear": True},+ {"type": "checkbox", "target": "#agree", "value": True},+ {"type": "checkbox", "target": "#agree", "value": False},+ {"type": "checkbox", "target": "#agree", "value": "false"},+ {"type": "radio", "target": "#pro", "value": True},+ {"type": "combobox", "target": "#country", "value": "United Kingdom"},+ {"type": "combobox", "target": "#colors", "value": ["Red", "Blue"]},+ {"type": "combobox", "target": "#colors", "value": []},]async with Client(server._build_server("127.0.0.1", 8000)) as client:result = await client.call_tool(@@ -202,10 +202,10 @@ async def test_browser_actions_fields_slow_pacing_and_empty_text(monkeypatch: pymonkeypatch.setattr("scrapling.core.ai._browser_actions.uniform", intervals)actions = [{**TEXT_FIELD, "value": "ab"},- {"type": "textbox", "ref": "e2", "value": ""},- {"type": "checkbox", "selector": "#agree", "value": True},- {"type": "radio", "selector": "#pro", "value": True},- {"type": "combobox", "selector": "#country", "value": "United Kingdom"},+ {"type": "textbox", "target": "aria-ref=e2", "value": ""},+ {"type": "checkbox", "target": "#agree", "value": True},+ {"type": "radio", "target": "#pro", "value": True},+ {"type": "combobox", "target": "#country", "value": "United Kingdom"},]async with Client(server._build_server("127.0.0.1", 8000)) as client:result = await client.call_tool(@@ -265,10 +265,10 @@ async def test_browser_actions_fields_slow_failure_stops_before_next_pause(@pytest.mark.parametrize("invalid",[- {"selector": None},- {"ref": "e1"},- {"selector": ""},- {"selector": None, "ref": ""},+ {"target": None},+ {"target": 123},+ {"target": ""},+ {"target": []},{"type": "unknown"},{"type": None},{"value": None},@@ -301,8 +301,11 @@ async def test_browser_actions_fields_invalid_later_field_prevents_all_actions(i{"actions": []},{"actions": None},{"actions": TEXT_FIELD},- {"actions": [{"type": "textbox", "selector": "#name"}]},- {"actions": [{"selector": "#name", "value": "value"}]},+ {"actions": [{"type": "textbox", "target": "#name"}]},+ {"actions": [{"type": "textbox", "value": "value"}]},+ {"actions": [{"type": "textbox", "selector": "#name", "value": "value"}]},+ {"actions": [{"type": "textbox", "ref": "e2", "value": "value"}]},+ {"actions": [{"target": "#name", "value": "value"}]},{"actions": [{**TEXT_FIELD, "timeout": -1}]},{"actions": [{**TEXT_FIELD, "timeout": None}]},{"actions": [TEXT_FIELD], "slowly": "invalid"},@@ -516,14 +519,14 @@ async def test_browser_actions_fields_live_mixed_fields_and_clearing() -> None:agree = search(r'checkbox "Agree".*?\[ref=([^\]]+)\]', snapshot.content[0].text)assert name is not None and agree is not Noneactions = [- {"type": "textbox", "ref": name[1], "value": "new α name"},- {"type": "textbox", "selector": 'xpath=//textarea[@id="notes"]', "value": "line one\nline two"},- {"type": "textbox", "selector": "#editor", "value": "edited content"},- {"type": "checkbox", "ref": agree[1], "value": True},- {"type": "checkbox", "selector": "#updates", "value": False},- {"type": "radio", "selector": "#pro", "value": True},- {"type": "combobox", "selector": "#country", "value": "United Kingdom"},- {"type": "combobox", "selector": "#colors", "value": ["Red", "Blue"]},+ {"type": "textbox", "target": f"aria-ref={name[1]}", "value": "new α name"},+ {"type": "textbox", "target": 'xpath=//textarea[@id="notes"]', "value": "line one\nline two"},+ {"type": "textbox", "target": "#editor", "value": "edited content"},+ {"type": "checkbox", "target": f"aria-ref={agree[1]}", "value": True},+ {"type": "checkbox", "target": "#updates", "value": False},+ {"type": "radio", "target": "#pro", "value": True},+ {"type": "combobox", "target": "#country", "value": "United Kingdom"},+ {"type": "combobox", "target": "#colors", "value": ["Red", "Blue"]},]filled = await client.call_tool("browser_actions", {"session_id": "browser", "actions": actions})assert not filled.is_error@@ -559,11 +562,11 @@ async def test_browser_actions_fields_live_mixed_fields_and_clearing() -> None:{"session_id": "browser","actions": [- {"type": "textbox", "selector": "#name", "value": ""},- {"type": "checkbox", "selector": "#agree", "value": False},- {"type": "checkbox", "selector": "#updates", "value": True},- {"type": "radio", "selector": "#basic", "value": True},- {"type": "combobox", "selector": "#colors", "value": []},+ {"type": "textbox", "target": "#name", "value": ""},+ {"type": "checkbox", "target": "#agree", "value": False},+ {"type": "checkbox", "target": "#updates", "value": True},+ {"type": "radio", "target": "#basic", "value": True},+ {"type": "combobox", "target": "#colors", "value": []},],},)@@ -585,12 +588,12 @@ async def test_browser_actions_fields_live_slow_typing_and_field_delays() -> Nonname = search(r'textbox "Name".*?\[ref=([^\]]+)\]', snapshot.content[0].text)assert name is not Noneactions = [- {"type": "textbox", "ref": name[1], "value": "abc"},- {"type": "textbox", "selector": "#notes", "value": "x\ny"},- {"type": "textbox", "selector": "#editor", "value": "xyα🙂"},- {"type": "checkbox", "selector": "#agree", "value": True},- {"type": "radio", "selector": "#pro", "value": True},- {"type": "combobox", "selector": "#country", "value": "United Kingdom"},+ {"type": "textbox", "target": f"aria-ref={name[1]}", "value": "abc"},+ {"type": "textbox", "target": "#notes", "value": "x\ny"},+ {"type": "textbox", "target": "#editor", "value": "xyα🙂"},+ {"type": "checkbox", "target": "#agree", "value": True},+ {"type": "radio", "target": "#pro", "value": True},+ {"type": "combobox", "target": "#country", "value": "United Kingdom"},]result = await client.call_tool("browser_actions", {"session_id": "browser", "actions": actions, "slowly": True}@@ -648,7 +651,7 @@ async def test_browser_actions_fields_live_caret_selection_and_submit(slowly: boassert session.page_pool.pages[0].state == "ready"await run([{**TEXT_FIELD, "value": "abcd"}, {"type": "press_key", "key": "ArrowLeft"}])- await run([{"type": "textbox", "ref": name[1], "value": "XY", "clear": False}])+ await run([{"type": "textbox", "target": f"aria-ref={name[1]}", "value": "XY", "clear": False}])assert await page.locator("#name").input_value() == "abcXYd"await run([@@ -663,13 +666,13 @@ async def test_browser_actions_fields_live_caret_selection_and_submit(slowly: boawait run([{**TEXT_FIELD, "value": "!", "clear": False},- {"type": "textbox", "selector": "#notes", "value": "new notes"},+ {"type": "textbox", "target": "#notes", "value": "new notes"},])assert await page.locator("#name").input_value() == "abcz!d"assert await page.locator("#notes").input_value() == "new notes"assert await page.locator("#submitted").inner_text() == "0"- await run([{"type": "click", "ref": name[1]}, {"type": "press_key", "key": "Enter"}])+ await run([{"type": "click", "target": f"aria-ref={name[1]}"}, {"type": "press_key", "key": "Enter"}])assert await page.locator("#submitted").inner_text() == "1"events = loads(await page.locator("#events").input_value())assert [@@ -688,8 +691,8 @@ async def test_browser_actions_fields_live_failed_field_preserves_prior_changes("session_id": "browser","actions": [{**TEXT_FIELD, "value": "changed first"},- {**TEXT_FIELD, "selector": selector, "value": "fails", "timeout": 100},- {**TEXT_FIELD, "selector": "#notes", "value": "must not run"},+ {**TEXT_FIELD, "target": selector, "value": "fails", "timeout": 100},+ {**TEXT_FIELD, "target": "#notes", "value": "must not run"},],},)diff --git a/tests/ai/test_browser_mouse.py b/tests/ai/test_browser_mouse.pyindex 45628fd..17c5a83 100644--- a/tests/ai/test_browser_mouse.py+++ b/tests/ai/test_browser_mouse.py@@ -89,25 +89,26 @@ async def test_browser_mouse_schema_and_annotations() -> None:"press_key",}assert len(items["oneOf"]) == 11+ assert "_Selector" not in schema["$defs"] and "_Ref" not in schema["$defs"]for kind in ("move", "click", "wheel"):variant = variants[kind]assert variant["required"] == ["type"]assert variant["properties"]["type"]["const"] == kindfor kind in ("move", "click"):- for target in ("selector", "ref"):- reference = variants[kind]["properties"][target]["$ref"]- assert schema["$defs"][reference.rsplit("/", 1)[1]] == {- "anyOf": [{"minLength": 1, "type": "string"}, {"type": "null"}],- "title": target.title(),- }+ assert variants[kind]["properties"]["target"] == {"$ref": "#/$defs/_Target"}+ assert schema["$defs"]["_Target"] == {+ "anyOf": [{"minLength": 1, "type": "string"}, {"type": "null"}],+ "description": "Playwright selector or snapshot ref as aria-ref=<ref>.",+ "title": "Target",+ }move = variants["move"]["properties"]- assert set(move) == {"type", "x", "y", "steps", "selector", "ref", "timeout"}+ assert set(move) == {"type", "x", "y", "steps", "target", "timeout"}assert move["steps"]["exclusiveMinimum"] == 0assert move["steps"]["default"] == 1assert move["timeout"]["minimum"] == 0assert move["timeout"]["default"] == 30000click = variants["click"]["properties"]- assert set(click) == {"type", "selector", "ref", "x", "y", "button", "click_count", "delay", "timeout"}+ assert set(click) == {"type", "target", "x", "y", "button", "click_count", "delay", "timeout"}assert set(click["button"]["enum"]) == {"left", "right", "middle"}assert click["click_count"]["exclusiveMinimum"] == 0assert click["delay"]["minimum"] == click["timeout"]["minimum"] == 0@@ -130,11 +131,14 @@ async def test_browser_mouse_schema_and_annotations() -> None:"tool, target, options, expected",[("move", {"x": -12.5, "y": 23.5}, {}, {"steps": 1}),+ ("move", {"x": -12.5, "y": 23.5, "target": None}, {}, {"steps": 1}),("move", {"x": -12.5, "y": 23.5}, {"steps": 5, "timeout": 400}, {"steps": 5}),- ("move", {"selector": "button"}, {}, {"timeout": 30000}),- ("move", {"ref": "e4"}, {"steps": 5, "timeout": 500}, {"timeout": 500}),- ("move", {"selector": "button"}, {"timeout": 0}, {"timeout": 0}),+ ("move", {"target": "button"}, {}, {"timeout": 30000}),+ ("move", {"target": "aria-ref=e4"}, {"steps": 5, "timeout": 500}, {"timeout": 500}),+ ("move", {"target": "button"}, {"timeout": 0}, {"timeout": 0}),+ ("move", {"target": "e12", "x": None, "y": None}, {}, {"timeout": 30000}),("click", {"x": -12.5, "y": 23.5}, {}, {"button": "left", "click_count": 1, "delay": 0}),+ ("click", {"x": -12.5, "y": 23.5, "target": None}, {}, {"button": "left", "click_count": 1, "delay": 0}),("click",{"x": -12.5, "y": 23.5},@@ -143,13 +147,13 @@ async def test_browser_mouse_schema_and_annotations() -> None:),("click",- {"selector": "button"},+ {"target": "button"},{},{"button": "left", "click_count": 1, "delay": 0, "timeout": 30000},),("click",- {"ref": "e4"},+ {"target": "aria-ref=e4"},{"button": "right", "click_count": 2, "delay": 30, "timeout": 500},{"button": "right", "click_count": 2, "delay": 30, "timeout": 500},),@@ -166,16 +170,16 @@ async def test_browser_mouse_forwards_native_actions(assert not result.is_errorassert result.structured_content is Noneassert result.content == [TextContent(type="text", text="Actions completed.")]- if tool == "move" and "x" in target:+ if tool == "move" and target.get("x") is not None:page.mouse.move.assert_awaited_once_with(-12.5, 23.5, **expected)page.mouse.click.assert_not_awaited()page.locator.assert_not_called()- elif "x" in target:+ elif target.get("x") is not None:page.mouse.click.assert_awaited_once_with(-12.5, 23.5, **expected)page.mouse.move.assert_not_awaited()page.locator.assert_not_called()else:- page.locator.assert_called_once_with(target["selector"] if "selector" in target else "aria-ref=e4")+ page.locator.assert_called_once_with(target["target"])action = "hover" if tool == "move" else "click"getattr(page.locator.return_value, action).assert_awaited_once_with(**expected)getattr(page.locator.return_value, "click" if action == "hover" else "hover").assert_not_awaited()@@ -205,8 +209,8 @@ async def test_browser_mouse_forwards_native_actions(("move", {"steps": 1.5}),("move", {"steps": 0}),("move", {"steps": -1}),- ("move", {"selector": ""}),- ("move", {"ref": ""}),+ ("move", {"target": ""}),+ ("move", {"target": 123}),("move", {"timeout": -1}),("click", {"button": "back"}),("click", {"click_count": 1.5}),@@ -215,8 +219,8 @@ async def test_browser_mouse_forwards_native_actions(("click", {"delay": -1}),("click", {"delay": "invalid"}),("click", {"timeout": -1}),- ("click", {"selector": ""}),- ("click", {"ref": ""}),+ ("click", {"target": ""}),+ ("click", {"target": 123}),],)async def test_browser_mouse_invalid_input_does_not_reserve_or_use_page(tool: str, values: dict[str, Any]) -> None:@@ -262,11 +266,13 @@ def test_browser_mouse_schema_rejects_nonfinite_values(tool: str, fields: tuple[{},{"x": 1},{"y": 2},- {"selector": "button", "ref": "e2"},- {"selector": "button", "x": 1},- {"ref": "e2", "y": 2},- {"selector": "button", "x": 1, "y": 2},- {"ref": "e2", "x": 1, "y": 2},+ {"target": None},+ {"selector": "button"},+ {"ref": "e2"},+ {"target": "button", "x": 1},+ {"target": "aria-ref=e2", "y": 2},+ {"target": "button", "x": 1, "y": 2},+ {"target": "aria-ref=e2", "x": 1, "y": 2},],)async def test_browser_mouse_requires_exactly_one_complete_target(tool: str, target: dict[str, Any]) -> None:@@ -327,7 +333,7 @@ async def test_browser_mouse_session_errors_reach_mcp(tool: str, state: str, mes@pytest.mark.asyncio@pytest.mark.parametrize("tool", ["move", "click"])@pytest.mark.parametrize("closed", [False, True])[email protected]("target", [{"x": 10, "y": 20}, {"selector": "button"}, {"ref": "e1"}])[email protected]("target", [{"x": 10, "y": 20}, {"target": "button"}, {"target": "aria-ref=e1"}])async def test_browser_mouse_failure_is_not_retried_and_releases_page(tool: str, closed: bool, target: dict[str, Any]) -> None:@@ -362,7 +368,7 @@ async def test_browser_mouse_failure_is_not_retried_and_releases_page(@pytest.mark.asyncio[email protected]("target", [{"x": 10, "y": 20}, {"selector": "button"}, {"ref": "e1"}])[email protected]("target", [{"x": 10, "y": 20}, {"target": "button"}, {"target": "aria-ref=e1"}])async def test_browser_mouse_reserves_page_until_cancelled(target: dict[str, Any]) -> None:server, session, page = _server()entered = asyncio.Event()@@ -407,7 +413,7 @@ async def test_browser_mouse_click_timeout_holds_page_until_button_is_released()page.locator.return_value.click.side_effect = PatchrightTimeoutError("click timed out")page.mouse.up.side_effect = unpresstask = asyncio.create_task(- server.browser_actions("browser", [{"type": "click", "selector": "button", "button": "right"}])+ server.browser_actions("browser", [{"type": "click", "target": "button", "button": "right"}]))try:await asyncio.wait_for(releasing.wait(), 5)@@ -432,7 +438,7 @@ async def test_browser_mouse_click_timeout_holds_page_until_button_is_released()@pytest.mark.asyncio@pytest.mark.parametrize("cancel_mode", ["task", "scope"])[email protected]("target", [{"x": 10, "y": 20}, {"selector": "button"}, {"ref": "e1"}])[email protected]("target", [{"x": 10, "y": 20}, {"target": "button"}, {"target": "aria-ref=e1"}])async def test_browser_mouse_cancelled_click_holds_page_until_button_is_released(cancel_mode: str, target: dict[str, Any]) -> None:@@ -516,7 +522,7 @@ async def test_browser_mouse_cleanup_failure_preserves_click_error(with pytest.raises(asyncio.CancelledError if cancelled else RuntimeError) as error:await server.browser_actions("browser",- [{"type": "click", "selector": "#target", "button": "right"}, {"type": "wheel", "delta_y": 120}],+ [{"type": "click", "target": "#target", "button": "right"}, {"type": "wheel", "delta_y": 120}],)original = error.value if cancelled else error.value.__cause__if not cancelled:@@ -576,9 +582,9 @@ async def test_browser_mouse_mixed_chain_keeps_one_page_reserved() -> None:action.side_effect = recordactions = [{"type": "move", "x": 10, "y": 20, "steps": 4},- {"type": "move", "selector": "#panel", "timeout": 500},+ {"type": "move", "target": "#panel", "timeout": 500},{"type": "wheel", "delta_y": 120},- {"type": "click", "ref": "e4", "button": "right"},+ {"type": "click", "target": "aria-ref=e4", "button": "right"},{"type": "click", "x": 30, "y": 40, "click_count": 2},]async with Client(server._build_server("127.0.0.1", 8000)) as client:@@ -613,7 +619,7 @@ async def test_browser_mouse_chain_reports_failed_index_and_keeps_completed_actifailing.side_effect = native_erroractions = [{"type": "move", "x": 10, "y": 20},- {"type": kind, **({"selector": "#target"} if kind != "wheel" else {"delta_y": 120})},+ {"type": kind, **({"target": "#target"} if kind != "wheel" else {"delta_y": 120})},{"type": "click", "x": 30, "y": 40},]with pytest.raises(RuntimeError, match=rf"Action 2 \({kind}\) failed: native failure") as error:@@ -732,7 +738,7 @@ async def test_browser_mouse_live_cancelled_click_releases_native_button(cancel_if target_type == "ref":match = search(r'button "Target".*?\[ref=([^\]]+)\]', await server.browser_snapshot("browser"))assert match is not None- target = {"ref": match[1]}+ target = {"target": f"aria-ref={match[1]}"}task = asyncio.create_task(click())await page.wait_for_function("JSON.parse(document.querySelector('#events').value).some(event => event.type === 'mousedown')",@@ -792,10 +798,10 @@ async def test_browser_mouse_live_selectors_refs_and_scroll(tool: str) -> None:ref = match[1]initial_dom = await page.content()for target in (- {"selector": "#target"},- {"selector": 'xpath=//button[@id="target"]'},- {"ref": ref},- {"selector": "#below"},+ {"target": "#target"},+ {"target": 'xpath=//button[@id="target"]'},+ {"target": f"aria-ref={ref}"},+ {"target": "#below"},):await page.mouse.move(0, 0)await page.locator("#events").evaluate("element => element.value = '[]'")@@ -804,7 +810,7 @@ async def test_browser_mouse_live_selectors_refs_and_scroll(tool: str) -> None:)assert not result.is_errorevents = loads(await page.locator("#events").input_value())- expected_id = "below" if target.get("selector") == "#below" else "target"+ expected_id = "below" if target.get("target") == "#below" else "target"if tool == "move":assert events and all(event["type"] == "mousemove" and event["trusted"] for event in events)assert events[-1]["target"] == expected_id@@ -816,15 +822,15 @@ async def test_browser_mouse_live_selectors_refs_and_scroll(tool: str) -> None:assert await page.evaluate("window.scrollY") > 0assert await page.content() == initial_domawait page.locator("#target").evaluate("element => element.remove()")- for target in ({"selector": "button, a"}, {"selector": "#missing"}, {"ref": ref}):+ for target in ({"target": "button, a"}, {"target": "#missing"}, {"target": f"aria-ref={ref}"}):await page.locator("#events").evaluate("element => element.value = '[]'")with pytest.raises(RuntimeError, match=rf"Action 1 \({tool}\) failed:") as error:await server.browser_actions("browser",- [{"type": tool, "selector": target.get("selector"), "ref": target.get("ref"), "timeout": 100}],+ [{"type": tool, **target, "timeout": 100}],)events = loads(await page.locator("#events").input_value())- if target.get("selector") != "button, a":+ if target.get("target") != "button, a":assert isinstance(error.value.__cause__, PatchrightTimeoutError)assert not any(event["type"] in ("mousedown", "click") for event in events)released = [event for event in events if event["type"] == "mouseup"]@@ -865,7 +871,7 @@ async def test_browser_mouse_click_live_timeout_releases_native_button() -> None"browser_actions",{"session_id": "browser",- "actions": [{"type": "click", "selector": "#target", "delay": 1000, "timeout": 300}],+ "actions": [{"type": "click", "target": "#target", "delay": 1000, "timeout": 300}],},)assert failed.is_errordiff --git a/tests/ai/test_browser_network.py b/tests/ai/test_browser_network.pyindex 803666c..89646fa 100644--- a/tests/ai/test_browser_network.py+++ b/tests/ai/test_browser_network.py@@ -917,8 +917,8 @@ async def test_network_live_capture_actions_navigation_and_reads() -> None:{"session_id": "browser","actions": [- {"type": "click", "selector": "#load"},- {"type": "wait_element", "selector": "body[data-done=yes]", "timeout": 2000},+ {"type": "click", "target": "#load"},+ {"type": "wait_element", "target": "body[data-done=yes]", "timeout": 2000},],},)diff --git a/tests/ai/test_browser_press_key.py b/tests/ai/test_browser_press_key.pyindex e4d19c4..3863d86 100644--- a/tests/ai/test_browser_press_key.py+++ b/tests/ai/test_browser_press_key.py@@ -219,7 +219,7 @@ async def test_browser_actions_keys_live_focus_editing_and_shortcuts() -> None:typed = await client.call_tool("browser_actions",- {"session_id": "browser", "actions": [{"type": "textbox", "selector": "#first", "value": "initial"}]},+ {"session_id": "browser", "actions": [{"type": "textbox", "target": "#first", "value": "initial"}]},)assert not typed.is_errorawait page.locator("#events").evaluate("element => element.value = '[]'")diff --git a/tests/ai/test_browser_screenshot.py b/tests/ai/test_browser_screenshot.pyindex 8494f1f..ab3c2d3 100644--- a/tests/ai/test_browser_screenshot.py+++ b/tests/ai/test_browser_screenshot.py@@ -467,10 +467,10 @@ async def test_browser_screenshot_live_preserves_actions_and_current_page() -> N{"session_id": "browser","actions": [- {"type": "textbox", "selector": "#name", "value": "Scrapling"},- {"type": "checkbox", "selector": "#agree", "value": True},- {"type": "click", "selector": "#toggle"},- {"type": "click", "selector": "#name"},+ {"type": "textbox", "target": "#name", "value": "Scrapling"},+ {"type": "checkbox", "target": "#agree", "value": True},+ {"type": "click", "target": "#toggle"},+ {"type": "click", "target": "#name"},{"type": "move", "x": 400, "y": 300},{"type": "wheel", "delta_y": 600},],diff --git a/tests/ai/test_browser_wait.py b/tests/ai/test_browser_wait.pyindex f2f370a..35cf45d 100644--- a/tests/ai/test_browser_wait.py+++ b/tests/ai/test_browser_wait.py@@ -62,8 +62,8 @@ async def test_browser_wait_schema_and_annotations() -> None:assert len(items["oneOf"]) == 11assert variants["wait_time"]["required"] == ["type", "milliseconds"]assert variants["wait_time"]["properties"]["milliseconds"]["minimum"] == 0- assert variants["wait_element"]["required"] == ["type", "selector"]- assert variants["wait_element"]["properties"]["selector"]["minLength"] == 1+ assert variants["wait_element"]["required"] == ["type", "target"]+ assert variants["wait_element"]["properties"]["target"]["minLength"] == 1assert set(variants["wait_element"]["properties"]["state"]["enum"]) == {"attached", "detached", "visible", "hidden"}assert variants["wait_element"]["properties"]["state"]["default"] == "visible"assert variants["wait_load"]["required"] == ["type", "state"]@@ -85,10 +85,10 @@ async def test_browser_wait_schema_and_annotations() -> None:[({"type": "wait_time", "milliseconds": 0}, "wait_for_timeout", (0,), {}),({"type": "wait_time", "milliseconds": 12.5}, "wait_for_timeout", (12.5,), {}),- ({"type": "wait_element", "selector": "#ready"}, "locator", (), {"state": "visible", "timeout": 30000}),+ ({"type": "wait_element", "target": "#ready"}, "locator", (), {"state": "visible", "timeout": 30000}),*[(- {"type": "wait_element", "selector": "#ready", "state": state, "timeout": 0},+ {"type": "wait_element", "target": "#ready", "state": state, "timeout": 0},"locator",(),{"state": state, "timeout": 0},@@ -147,9 +147,9 @@ async def test_browser_wait_mixed_chain_keeps_order_and_page_reservation() -> No"session_id": "browser","actions": [{"type": "wait_load", "state": "domcontentloaded"},- {"type": "wait_element", "selector": "#ready", "timeout": 15},+ {"type": "wait_element", "target": "#ready", "timeout": 15},{"type": "wait_time", "milliseconds": 2.5},- {"type": "wait_element", "selector": "#ready", "state": "hidden", "timeout": 0},+ {"type": "wait_element", "target": "#ready", "state": "hidden", "timeout": 0},],},)@@ -183,13 +183,17 @@ async def test_browser_wait_mixed_chain_keeps_order_and_page_reservation() -> No{"type": "wait_time", "milliseconds": "NaN"},{"type": "wait_time", "milliseconds": "Infinity"},{"type": "wait_element"},- {"type": "wait_element", "selector": ""},- {"type": "wait_element", "selector": "#ready", "state": "missing"},+ {"type": "wait_element", "target": ""},+ {"type": "wait_element", "target": None},+ {"type": "wait_element", "target": 123},+ {"type": "wait_element", "selector": "#ready"},+ {"type": "wait_element", "ref": "e2"},+ {"type": "wait_element", "target": "#ready", "state": "missing"},{"type": "wait_load"},{"type": "wait_load", "state": "commit"},{"type": "wait_load", "state": "load", "timeout": -1},{"type": "wait_load", "state": "load", "timeout": "NaN"},- {"type": "wait_element", "selector": "#ready", "timeout": "Infinity"},+ {"type": "wait_element", "target": "#ready", "timeout": "Infinity"},)],],@@ -208,7 +212,7 @@ async def test_browser_wait_invalid_batch_does_not_start_or_reserve_page(actions@pytest.mark.asyncio@pytest.mark.parametrize(- "values", [{"type": "wait_element", "selector": "#missing"}, {"type": "wait_load", "state": "networkidle"}]+ "values", [{"type": "wait_element", "target": "#missing"}, {"type": "wait_load", "state": "networkidle"}])async def test_browser_wait_native_timeout_reaches_mcp_and_releases_page(values: dict[str, Any]) -> None:server, session, page = _server()@@ -359,7 +363,7 @@ async def test_browser_wait_live_pause_and_element_states() -> None:"browser_actions",{"session_id": "browser",- "actions": [{"type": "wait_element", "selector": "#target", "state": state, "timeout": 5000}],+ "actions": [{"type": "wait_element", "target": "#target", "state": state, "timeout": 5000}],},)assert not result.is_error@@ -374,7 +378,7 @@ async def test_browser_wait_live_pause_and_element_states() -> None:"browser_actions",{"session_id": "browser",- "actions": [{"type": "wait_element", "selector": "#absent", "state": state, "timeout": 100}],+ "actions": [{"type": "wait_element", "target": "#absent", "state": state, "timeout": 100}],},)).is_error@@ -383,7 +387,7 @@ async def test_browser_wait_live_pause_and_element_states() -> None:"browser_actions",{"session_id": "browser",- "actions": [{"type": "wait_element", "selector": ".duplicate", "state": "attached", "timeout": 100}],+ "actions": [{"type": "wait_element", "target": ".duplicate", "state": "attached", "timeout": 100}],},)assert result.is_error and isinstance(result.content[0], TextContent)@@ -463,8 +467,8 @@ async def test_browser_wait_live_load_visible_hidden_chain() -> None:"session_id": "browser","actions": [{"type": "wait_load", "state": "load", "timeout": 5000},- {"type": "wait_element", "selector": "#target", "state": "visible", "timeout": 5000},- {"type": "wait_element", "selector": "#target", "state": "hidden", "timeout": 5000},+ {"type": "wait_element", "target": "#target", "state": "visible", "timeout": 5000},+ {"type": "wait_element", "target": "#target", "state": "hidden", "timeout": 5000},],},)