[v4]: unify selector type
Merged
SE
8mo ago+216+216+012345678901234567890123456789-231-231-012345678901234567890123456789
why
- to unify
selectorinto a single field across page request bodies - this groups semantically similar fields into a shared & reusable type
what changed
- replaced
PageSelectorSchema(xpath-only object) with a discriminated union of 4 selector types:PageXPathSelectorSchema,PageCssSelectorSchema,PageTextSelectorSchema,PageCoordinateSelectorSchema
- added
PageElementSelectorSchema(xpath/css/text, no coordinates) forwaitForSelector - collapsed the dual
*SelectorParams/*CoordinatesParamsschema pairs for click, hover, scroll, and dragAndDrop into single schemas with a unifiedselectorfield
example /hover before:
example /hover after:
test plan
- added integration tests for css, text, and coordinate selector types
Summary by cubic
Unifies the v4 page selector into a single selector union and adds css, text, and coordinate options. This simplifies request bodies and makes click, hover, scroll, and drag‑and‑drop consistent.
-
New Features
- One
selectorunion for all page actions: xpath, css, text, or coordinates. - Introduced
SelectorandElementSelectorunions; split formerPageSelectorintoXPathSelector,CssSelector,TextSelector, andCoordinateSelector. - Added
ElementSelector(xpath/css/text) for element‑only cases likewaitForSelectorand scroll‑by‑percentage; exportedPageScrollElementParamsandPageScrollCoordinateParams. dragAndDropsupports mixing selector types (e.g., xpath → coordinates).- Added integration tests for css, text, coordinate selectors, and mixed drag‑and‑drop.
- One
-
Migration
- click/hover: always send
{ selector: { xpath|css|text|x,y } }. Remove top‑levelx/y. - scroll: use element selector +
percentage, or coordinate selector +deltaY. - dragAndDrop:
from/tonow use the unified selector (elements or coordinates). - waitForSelector: use
ElementSelector(no coordinates).
- click/hover: always send