Table of Contents

Class PageLocatorOptions

Namespace
Microsoft.Playwright
Assembly
Microsoft.Playwright.dll
public class PageLocatorOptions
Inheritance
PageLocatorOptions
Inherited Members

Constructors

PageLocatorOptions()

public PageLocatorOptions()

PageLocatorOptions(PageLocatorOptions)

public PageLocatorOptions(PageLocatorOptions clone)

Parameters

clone PageLocatorOptions

Properties

Has

Narrows down the results of the method to those which contain elements matching this relative locator. For example, article that has text=Playwright matches <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 content that has div in <article><content><div>Playwright</div></content></article>. However, looking for content that has article div will fail, because the inner locator must be relative and should not use any elements outside the content.

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

[JsonPropertyName("has")]
public ILocator? Has { get; set; }

Property Value

ILocator

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

[JsonPropertyName("hasNot")]
public ILocator? HasNot { get; set; }

Property Value

ILocator

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.

[JsonPropertyName("hasNotText")]
public string? HasNotText { get; set; }

Property Value

string

HasNotTextRegex

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.

[JsonPropertyName("hasNotTextRegex")]
public Regex? HasNotTextRegex { get; set; }

Property Value

Regex

HasNotTextString

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.

[JsonPropertyName("hasNotTextString")]
public string? HasNotTextString { get; set; }

Property Value

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

[JsonPropertyName("hasText")]
public string? HasText { get; set; }

Property Value

string

HasTextRegex

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

[JsonPropertyName("hasTextRegex")]
public Regex? HasTextRegex { get; set; }

Property Value

Regex

HasTextString

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

[JsonPropertyName("hasTextString")]
public string? HasTextString { get; set; }

Property Value

string