Class Image
java.lang.Object
net.serenitybdd.screenplay.playwright.ui.Image
Factory for locating image elements using Playwright selectors.
Uses Playwright's role selectors and attribute matching for image location.
Sample usage:
Target logo = Image.withAltText("Company Logo");
Target avatar = Image.withSrc("/images/avatar.png");
Target productImage = Image.withSrcContaining("product-");
-
Method Summary
Modifier and TypeMethodDescriptionstatic TargetLocate an image using a custom Playwright selector.static TargetwithAltText(String alt) Locate an image by its alt text (case-insensitive).static TargetLocate an image by its exact src attribute.static TargetwithSrcContaining(String part) Locate an image whose src contains the specified substring.
-
Method Details
-
withAltText
Locate an image by its alt text (case-insensitive). Uses Playwright's role selector for semantic image matching.- Parameters:
alt- The image's alt text- Returns:
- A Target for the image element
-
withSrc
Locate an image by its exact src attribute.- Parameters:
src- The exact src URL- Returns:
- A Target for the image element
-
withSrcContaining
Locate an image whose src contains the specified substring.- Parameters:
part- The substring to search for in the src attribute- Returns:
- A Target for the image element
-
locatedBy
Locate an image using a custom Playwright selector.- Parameters:
selector- A valid Playwright selector- Returns:
- A Target for the image element
-