Class Finder

java.lang.Object
io.karatelabs.driver.Finder

public class Finder extends Object
Positional element finder for relative locators. Allows finding elements based on their position relative to a reference element.
  • Constructor Details

  • Method Details

    • within

      public Finder within(double pixels)
      Set the tolerance for "near" matching.
      Parameters:
      pixels - the tolerance in pixels
      Returns:
      a new Finder with the specified tolerance
    • find

      public Element find(String locator)
      Find the first element matching the locator that satisfies the positional constraint.
      Parameters:
      locator - the locator for candidate elements
      Returns:
      the first matching element
      Throws:
      DriverException - if no matching element is found
    • findAll

      public List<Element> findAll(String locator)
      Find all elements matching the locator that satisfy the positional constraint.
      Parameters:
      locator - the locator for candidate elements
      Returns:
      list of matching elements, sorted by distance to reference
    • click

      public Element click(String locator)
      Click the first matching element.
    • exists

      public boolean exists(String locator)
      Check if the element exists.