Class Locator.LocatorOptions

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

public static class Locator.LocatorOptions 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

    • LocatorOptions

      public LocatorOptions()
  • Method Details

    • setHas

      public Locator.LocatorOptions 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.LocatorOptions 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.LocatorOptions 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.LocatorOptions 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.LocatorOptions 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.LocatorOptions 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>.