Class Locator.LocatorOptions

  • Enclosing interface:
    Locator

    public static class Locator.LocatorOptions
    extends Object
    • Field Detail

      • 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.

      • 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 Detail

      • LocatorOptions

        public LocatorOptions()
    • Method Detail

      • 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.

      • 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>.