Class: LinkedCssLocator
Defined in: packages/core/src/locators/LinkedCssLocator.ts:32
Extends​
Constructors​
Constructor​
new LinkedCssLocator(
selector,initializeValue):LinkedCssLocator
Defined in: packages/core/src/locators/LinkedCssLocator.ts:44
Parameters​
selector​
string
initializeValue​
LinkedCssLocatorInitializer & Partial<CssLocatorInitializer>
Returns​
LinkedCssLocator
Overrides​
Properties​
selector​
readonlyselector:string
Defined in: packages/core/src/locators/CssLocator.ts:16
Inherited from​
Accessors​
complexity​
Get Signature​
get complexity():
LocatorComplexity
Defined in: packages/core/src/locators/LinkedCssLocator.ts:51
Returns​
LocatorComplexity
Overrides​
matchingTargetLocator​
Get Signature​
get matchingTargetLocator():
PartLocator
Defined in: packages/core/src/locators/LinkedCssLocator.ts:59
Returns​
matchingTargetValueExtract​
Get Signature​
get matchingTargetValueExtract():
LinkedCssLocatorAttributeValueExtract
Defined in: packages/core/src/locators/LinkedCssLocator.ts:63
Returns​
LinkedCssLocatorAttributeValueExtract
relative​
Get Signature​
get relative():
LocatorRelativePosition
Defined in: packages/core/src/locators/CssLocator.ts:25
Returns​
Inherited from​
valueExtract​
Get Signature​
get valueExtract():
LinkedCssLocatorAttributeValueExtract
Defined in: packages/core/src/locators/LinkedCssLocator.ts:55
Returns​
LinkedCssLocatorAttributeValueExtract
Methods​
and()​
and(...
locators):CssLocator
Defined in: packages/core/src/locators/CssLocator.ts:75
Compose additional matchers onto the SAME element, producing one compound
CSS selector — e.g. [role="button"] and [aria-label="Open"] together
become [role="button"][aria-label="Open"].
This is the ergonomic, footgun-free form of same-element composition: it
supersedes locatorUtil.append(byRole('button'), byAriaLabel('Open', 'Same'))
— there is no 'Same' argument to remember (the relationship no longer has
to be stored on the appended child) and no wrapper call. The result keeps
THIS locator's position relative to its parent; the appended matchers
contribute only their attribute/selector fragment.
Same-element, pure-CSS only:
- Put a tag-name matcher (byTagName) FIRST — a CSS type selector is
only valid at the start of a compound (
input[type="text"], never[type="text"]input). - Computed accessible names (
aria-labelledby/<label>/ text) are not CSS-expressible and stay out of scope (see #923); compose a verbatimaria-labelvia byAriaLabel instead. - Linked locators (byLinkedElement) resolve at runtime and cannot be
folded into a static compound; calling
.and()on one, or passing one, throws.
Parameters​
locators​
...CssLocator[]
Additional same-element matchers to compound onto this one.
Returns​
Example​
const openButton = byRole('button').and(byAriaLabel('Open'));
const activeTab = byRole('tab').and(byAttribute('aria-selected', 'true'));
Inherited from​
chain()​
chain(...
locatorsToAppend):PartLocator
Defined in: packages/core/src/locators/CssLocator.ts:29
Parameters​
locatorsToAppend​
...PartLocator[]
Returns​
Inherited from​
clone()​
clone(
override?):LinkedCssLocator
Defined in: packages/core/src/locators/LinkedCssLocator.ts:67
Parameters​
override?​
Partial<LinkedCssLocatorInitializer> & Partial<CssLocatorInitializer>
Returns​
LinkedCssLocator