Class AnchorLocator

java.lang.Object
com.vaadin.browserless.locator.Locator<com.vaadin.flow.component.html.Anchor,AnchorLocator>
com.vaadin.flow.component.html.AnchorLocator
All Implemented Interfaces:
Clickable<com.vaadin.flow.component.html.Anchor>, HasAriaLabelFilter<com.vaadin.flow.component.html.Anchor,AnchorLocator>, HasTextFilter<com.vaadin.flow.component.html.Anchor,AnchorLocator>

@Generated("com.vaadin.browserless.locator.processor.LocatorProcessor") public class AnchorLocator extends Locator<com.vaadin.flow.component.html.Anchor,AnchorLocator> implements Clickable<com.vaadin.flow.component.html.Anchor>, HasTextFilter<com.vaadin.flow.component.html.Anchor,AnchorLocator>, HasAriaLabelFilter<com.vaadin.flow.component.html.Anchor,AnchorLocator>
Generated locator for Anchor, derived from AnchorTester. Filter steps are inherited from Locator; action methods delegate to a fresh tester around the resolved component, so behavioral changes belong on the tester, not here.
  • Constructor Details

    • AnchorLocator

      public AnchorLocator()
      Creates a locator that searches for a Anchor.
    • AnchorLocator

      public AnchorLocator(com.vaadin.flow.component.html.Anchor component)
      Creates a locator already bound to the given component, so that the action methods run against it instead of against a lookup.
      Parameters:
      component - the component the locator resolves to
  • Method Details

    • getComponent

      public com.vaadin.flow.component.html.Anchor getComponent()
      Description copied from interface: Clickable
      Gets the component being tested.
      Specified by:
      getComponent in interface Clickable<com.vaadin.flow.component.html.Anchor>
      Returns:
      the component under test
    • ensureComponentIsUsable

      public void ensureComponentIsUsable()
      Description copied from interface: Clickable
      Ensures the component is in a usable state before interaction.
      Specified by:
      ensureComponentIsUsable in interface Clickable<com.vaadin.flow.component.html.Anchor>
    • getHref

      public String getHref()
      Gets the URL that the anchor links to. Javadoc copied from AnchorTester.getHref().
      Returns:
      the href value, or "" if no href has been set
    • getPath

      public String getPath()
      Gets the path for the router-link. Returns an empty String if there is no corresponding navigation target. Javadoc copied from AnchorTester.getPath().
      Returns:
      a String containing the navigation target path or empty if not present
    • getQueryParameters

      public com.vaadin.flow.router.QueryParameters getQueryParameters()
      Gets the query parameters for the router-link. Javadoc copied from AnchorTester.getQueryParameters().
      Returns:
      a QueryParameters containing the navigation target's query parameters
    • click

      public void click()
      Click the anchor for navigation if target is a registered route in the application. This is equivalent to calling AnchorTester.navigate(). For cases where you need to access the navigated view, use AnchorTester.navigate() instead as it returns the target view. Javadoc copied from AnchorTester.click().
      Specified by:
      click in interface Clickable<com.vaadin.flow.component.html.Anchor>
      Throws:
      IllegalStateException - if anchor href is not a String or not a route
    • download

      public void download(OutputStream outputStream)
      Download the stream resource linked by the anchor. Javadoc copied from AnchorTester.download(java.io.OutputStream).
      Parameters:
      outputStream - output stream to write the stream resource to
      Throws:
      IllegalStateException - if the anchor does not link to a stream resource
    • getText

      public String getText()
      Get the text for target html component. Javadoc copied from HtmlContainerTester.getText().
      Returns:
      text of component
      Throws:
      IllegalStateException - if component not visible
    • getTitle

      public String getTitle()
      Get the title string set for the html component if available. Javadoc copied from HtmlComponentTester.getTitle().
      Returns:
      title string
      Throws:
      IllegalStateException - if not title has been set