Interface Locators

All Superinterfaces:
GeneratedLocators
All Known Subinterfaces:
CommercialLocators
All Known Implementing Classes:
BrowserlessUIContext

public interface Locators extends GeneratedLocators
Mixin offering typed entry points for the find* tester API.

Most entry points come from GeneratedLocators, which is emitted by the locator annotation processor at build time. This interface adds the generic find(Supplier) for user-defined locators and the activateLocatorContext() hook that context-bound implementations (e.g. BrowserlessUIContext) override.

  • Method Details

    • activateLocatorContext

      default void activateLocatorContext()
      Hook for context-bound implementations to install Vaadin thread-locals before a locator is built. Default is a no-op.
      Specified by:
      activateLocatorContext in interface GeneratedLocators
    • find

      default <L extends Locator<?, L>> L find(Supplier<L> factory)
      Generic entry point for user-defined locators. Activates the locator context (so thread-locals and the security snapshot are restored on a window switch) and invokes the supplied factory.
       window.find(CheckoutFormLocator::new).withId("checkout").submit();
       
      Throws:
      IllegalStateException - if the factory returns null instead of a fresh locator instance.