Class LocatorBuilder

java.lang.Object
com.shaft.gui.internal.locator.LocatorBuilder

public class LocatorBuilder extends Object
  • Method Details

    • cleanup

      public static void cleanup()
      Removes all thread-local state held by this builder, preventing memory leaks in long-running or parallel test environments.
    • hasTagName

      public static LocatorBuilder hasTagName(String tagName)
    • hasAttribute

      public LocatorBuilder hasAttribute(String attribute)
    • hasAttribute

      public LocatorBuilder hasAttribute(String attribute, String value)
    • containsAttribute

      public LocatorBuilder containsAttribute(String attribute, String value)
    • hasId

      public LocatorBuilder hasId(String id)
    • containsId

      public LocatorBuilder containsId(String id)
    • hasClass

      public LocatorBuilder hasClass(String className)
    • containsClass

      public LocatorBuilder containsClass(String className)
    • hasText

      public LocatorBuilder hasText(String text)
    • hasNormalizedText

      public LocatorBuilder hasNormalizedText(String text)
      Matches an element whose whitespace-normalized text equals text: internal runs of whitespace collapsed to a single space, then leading/trailing whitespace trimmed (XPath normalize-space(.)), rather than hasText(String)'s exact raw string-value comparison. Use this when the expected text was itself captured through an equivalent normalization step (e.g. a recorded accessible name), since real markup is rarely free of surrounding or internal whitespace.
      Parameters:
      text - the whitespace-normalized text to match
      Returns:
      self reference to continue building the locator
    • containsText

      public LocatorBuilder containsText(String text)
    • hasIndex

      public LocatorBuilder hasIndex(int index)
    • isFirst

      public LocatorBuilder isFirst()
    • isLast

      public LocatorBuilder isLast()
    • and

      public LocatorBuilder and()
      Syntactic Sugar
      Returns:
      self reference to continue building the locator
    • byRelation

      public org.openqa.selenium.support.locators.RelativeLocator.RelativeBy byRelation()
    • byAxis

      public XpathAxis byAxis()
    • byRole

      public static LocatorBuilder byRole(Role ariaRole)
    • build

      public org.openqa.selenium.By build()
    • buildPortable

      public ShaftLocator buildPortable()
    • buildForPlaywright

      public com.microsoft.playwright.Locator buildForPlaywright(com.microsoft.playwright.Page page)
    • insideShadowDom

      public ShadowLocatorBuilder insideShadowDom(org.openqa.selenium.By shadowDomLocator)