Class Link
java.lang.Object
net.serenitybdd.screenplay.playwright.ui.Link
Factory for locating link (anchor) elements using Playwright selectors.
Uses Playwright's role selectors and CSS pseudo-classes for flexible link location.
Sample usage:
Target homeLink = Link.withText("Home");
Target learnMoreLink = Link.containingText("Learn more");
Target helpLink = Link.withTitle("Get help");
-
Method Summary
Modifier and TypeMethodDescriptionstatic TargetcontainingText(String text) Locate a link containing the specified text (partial match).static TargetLocate a link using a custom Playwright selector.static TargetLocate a link by its exact accessible name (case-insensitive).static TargetLocate a link by its title attribute (case-insensitive).
-
Method Details
-
withText
Locate a link by its exact accessible name (case-insensitive). Uses Playwright's role selector for semantic link matching.- Parameters:
text- The link's accessible name or text content- Returns:
- A Target for the link element
-
containingText
Locate a link containing the specified text (partial match).- Parameters:
text- The text to search for within the link- Returns:
- A Target for the link element
-
withTitle
Locate a link by its title attribute (case-insensitive).- Parameters:
title- The title attribute value- Returns:
- A Target for the link element
-
locatedBy
Locate a link using a custom Playwright selector.- Parameters:
selector- A valid Playwright selector- Returns:
- A Target for the link element
-