Class Page.LocatorOptions
- java.lang.Object
-
- com.microsoft.playwright.Page.LocatorOptions
-
-
Field Summary
Fields Modifier and Type Field Description LocatorhasNarrows down the results of the method to those which contain elements matching this relative locator.LocatorhasNotMatches elements that do not contain an element that matches an inner locator.ObjecthasNotTextMatches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element.ObjecthasTextMatches elements containing specified text somewhere inside, possibly in a child or a descendant element.
-
Constructor Summary
Constructors Constructor Description LocatorOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Page.LocatorOptionssetHas(Locator has)Narrows down the results of the method to those which contain elements matching this relative locator.Page.LocatorOptionssetHasNot(Locator hasNot)Matches elements that do not contain an element that matches an inner locator.Page.LocatorOptionssetHasNotText(String hasNotText)Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element.Page.LocatorOptionssetHasNotText(Pattern hasNotText)Matches elements that do not contain specified text somewhere inside, possibly in a child or a descendant element.Page.LocatorOptionssetHasText(String hasText)Matches elements containing specified text somewhere inside, possibly in a child or a descendant element.Page.LocatorOptionssetHasText(Pattern hasText)Matches elements containing specified text somewhere inside, possibly in a child or a descendant element.
-
-
-
Field Detail
-
has
public Locator has
Narrows down the results of the method to those which contain elements matching this relative locator. For example,articlethat hastext=Playwrightmatches<article><div>Playwright</div></article>.Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the document root. For example, you can find
contentthat hasdivin<article><content><div>Playwright</div></content></article>. However, looking forcontentthat hasarticle divwill fail, because the inner locator must be relative and should not use any elements outside thecontent.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,articlethat does not havedivmatches<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>.
-
-
Method Detail
-
setHas
public Page.LocatorOptions setHas(Locator has)
Narrows down the results of the method to those which contain elements matching this relative locator. For example,articlethat hastext=Playwrightmatches<article><div>Playwright</div></article>.Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the document root. For example, you can find
contentthat hasdivin<article><content><div>Playwright</div></content></article>. However, looking forcontentthat hasarticle divwill fail, because the inner locator must be relative and should not use any elements outside thecontent.Note that outer and inner locators must belong to the same frame. Inner locator must not contain
FrameLocators.
-
setHasNot
public Page.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,articlethat does not havedivmatches<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 Page.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 Page.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 Page.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 Page.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>.
-
-