Class Locator.FilterOptions

java.lang.Object
com.microsoft.playwright.Locator.FilterOptions
Enclosing interface:
Locator

public static class Locator.FilterOptions extends Object
  • Field Details

    • has

      public Locator has
      Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one. For example, article that has text=Playwright matches <article><div>Playwright</div></article>.

      Note that outer and inner locators must belong to the same frame. Inner locator must not contain FrameLocators.

    • hasNot

      public Locator hasNot
      Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the outer one. For example, article that does not have div matches <article><span>Playwright</span></article>.

      Note that outer and inner locators must belong to the same frame. Inner locator must not contain FrameLocators.

    • hasNotText

      public Object hasNotText
      Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When passed a [string], matching is case-insensitive and searches for a substring.
    • hasText

      public Object hasText
      Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a [string], matching is case-insensitive and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>.
  • Constructor Details

    • FilterOptions

      public FilterOptions()
  • Method Details

    • setHas

      public Locator.FilterOptions setHas(Locator has)
      Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one. For example, article that has text=Playwright matches <article><div>Playwright</div></article>.

      Note that outer and inner locators must belong to the same frame. Inner locator must not contain FrameLocators.

    • setHasNot

      public Locator.FilterOptions setHasNot(Locator hasNot)
      Matches elements that do not contain an element that matches an inner locator. Inner locator is queried against the outer one. For example, article that does not have div matches <article><span>Playwright</span></article>.

      Note that outer and inner locators must belong to the same frame. Inner locator must not contain FrameLocators.

    • setHasNotText

      public Locator.FilterOptions setHasNotText(String hasNotText)
      Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When passed a [string], matching is case-insensitive and searches for a substring.
    • setHasNotText

      public Locator.FilterOptions setHasNotText(Pattern hasNotText)
      Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element. When passed a [string], matching is case-insensitive and searches for a substring.
    • setHasText

      public Locator.FilterOptions setHasText(String hasText)
      Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a [string], matching is case-insensitive and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>.
    • setHasText

      public Locator.FilterOptions setHasText(Pattern hasText)
      Matches elements containing specified text somewhere inside, possibly in a child or a descendant element. When passed a [string], matching is case-insensitive and searches for a substring. For example, "Playwright" matches <article><div>Playwright</div></article>.