feat: roll driver to 1.29.0-alpha-1668454236000 (#1121)
This commit is contained in:
@@ -11,7 +11,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
|
||||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->107.0.5304.62<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->108.0.5359.40<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->16.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Firefox <!-- GEN:firefox-version -->106.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
|
||||
@@ -81,9 +81,10 @@ public interface Browser extends AutoCloseable {
|
||||
public Boolean bypassCSP;
|
||||
/**
|
||||
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}.
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults.
|
||||
* Defaults to {@code "light"}.
|
||||
*/
|
||||
public ColorScheme colorScheme;
|
||||
public Optional<ColorScheme> colorScheme;
|
||||
/**
|
||||
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
|
||||
*/
|
||||
@@ -94,9 +95,9 @@ public interface Browser extends AutoCloseable {
|
||||
public Map<String, String> extraHTTPHeaders;
|
||||
/**
|
||||
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
|
||||
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
|
||||
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}.
|
||||
*/
|
||||
public ForcedColors forcedColors;
|
||||
public Optional<ForcedColors> forcedColors;
|
||||
public Geolocation geolocation;
|
||||
/**
|
||||
* Specifies if viewport supports touch events. Defaults to false.
|
||||
@@ -176,9 +177,10 @@ public interface Browser extends AutoCloseable {
|
||||
public RecordVideoSize recordVideoSize;
|
||||
/**
|
||||
* Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}.
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to
|
||||
* {@code "no-preference"}.
|
||||
*/
|
||||
public ReducedMotion reducedMotion;
|
||||
public Optional<ReducedMotion> reducedMotion;
|
||||
/**
|
||||
* Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code viewport}
|
||||
* is set.
|
||||
@@ -258,10 +260,11 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}.
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults.
|
||||
* Defaults to {@code "light"}.
|
||||
*/
|
||||
public NewContextOptions setColorScheme(ColorScheme colorScheme) {
|
||||
this.colorScheme = colorScheme;
|
||||
this.colorScheme = Optional.ofNullable(colorScheme);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -280,10 +283,10 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
|
||||
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
|
||||
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}.
|
||||
*/
|
||||
public NewContextOptions setForcedColors(ForcedColors forcedColors) {
|
||||
this.forcedColors = forcedColors;
|
||||
this.forcedColors = Optional.ofNullable(forcedColors);
|
||||
return this;
|
||||
}
|
||||
public NewContextOptions setGeolocation(double latitude, double longitude) {
|
||||
@@ -447,10 +450,11 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}.
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to
|
||||
* {@code "no-preference"}.
|
||||
*/
|
||||
public NewContextOptions setReducedMotion(ReducedMotion reducedMotion) {
|
||||
this.reducedMotion = reducedMotion;
|
||||
this.reducedMotion = Optional.ofNullable(reducedMotion);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -561,9 +565,10 @@ public interface Browser extends AutoCloseable {
|
||||
public Boolean bypassCSP;
|
||||
/**
|
||||
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}.
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults.
|
||||
* Defaults to {@code "light"}.
|
||||
*/
|
||||
public ColorScheme colorScheme;
|
||||
public Optional<ColorScheme> colorScheme;
|
||||
/**
|
||||
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
|
||||
*/
|
||||
@@ -574,9 +579,9 @@ public interface Browser extends AutoCloseable {
|
||||
public Map<String, String> extraHTTPHeaders;
|
||||
/**
|
||||
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
|
||||
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
|
||||
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}.
|
||||
*/
|
||||
public ForcedColors forcedColors;
|
||||
public Optional<ForcedColors> forcedColors;
|
||||
public Geolocation geolocation;
|
||||
/**
|
||||
* Specifies if viewport supports touch events. Defaults to false.
|
||||
@@ -656,9 +661,10 @@ public interface Browser extends AutoCloseable {
|
||||
public RecordVideoSize recordVideoSize;
|
||||
/**
|
||||
* Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}.
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to
|
||||
* {@code "no-preference"}.
|
||||
*/
|
||||
public ReducedMotion reducedMotion;
|
||||
public Optional<ReducedMotion> reducedMotion;
|
||||
/**
|
||||
* Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code viewport}
|
||||
* is set.
|
||||
@@ -738,10 +744,11 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}.
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults.
|
||||
* Defaults to {@code "light"}.
|
||||
*/
|
||||
public NewPageOptions setColorScheme(ColorScheme colorScheme) {
|
||||
this.colorScheme = colorScheme;
|
||||
this.colorScheme = Optional.ofNullable(colorScheme);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -760,10 +767,10 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
|
||||
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
|
||||
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}.
|
||||
*/
|
||||
public NewPageOptions setForcedColors(ForcedColors forcedColors) {
|
||||
this.forcedColors = forcedColors;
|
||||
this.forcedColors = Optional.ofNullable(forcedColors);
|
||||
return this;
|
||||
}
|
||||
public NewPageOptions setGeolocation(double latitude, double longitude) {
|
||||
@@ -927,10 +934,11 @@ public interface Browser extends AutoCloseable {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}.
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to
|
||||
* {@code "no-preference"}.
|
||||
*/
|
||||
public NewPageOptions setReducedMotion(ReducedMotion reducedMotion) {
|
||||
this.reducedMotion = reducedMotion;
|
||||
this.reducedMotion = Optional.ofNullable(reducedMotion);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -407,9 +407,10 @@ public interface BrowserType {
|
||||
public Boolean chromiumSandbox;
|
||||
/**
|
||||
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}.
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults.
|
||||
* Defaults to {@code "light"}.
|
||||
*/
|
||||
public ColorScheme colorScheme;
|
||||
public Optional<ColorScheme> colorScheme;
|
||||
/**
|
||||
* Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}.
|
||||
*/
|
||||
@@ -441,9 +442,9 @@ public interface BrowserType {
|
||||
public Map<String, String> extraHTTPHeaders;
|
||||
/**
|
||||
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
|
||||
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
|
||||
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}.
|
||||
*/
|
||||
public ForcedColors forcedColors;
|
||||
public Optional<ForcedColors> forcedColors;
|
||||
public Geolocation geolocation;
|
||||
/**
|
||||
* Close the browser process on SIGHUP. Defaults to {@code true}.
|
||||
@@ -548,9 +549,10 @@ public interface BrowserType {
|
||||
public RecordVideoSize recordVideoSize;
|
||||
/**
|
||||
* Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}.
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to
|
||||
* {@code "no-preference"}.
|
||||
*/
|
||||
public ReducedMotion reducedMotion;
|
||||
public Optional<ReducedMotion> reducedMotion;
|
||||
/**
|
||||
* Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code viewport}
|
||||
* is set.
|
||||
@@ -666,10 +668,11 @@ public interface BrowserType {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}.
|
||||
* {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults.
|
||||
* Defaults to {@code "light"}.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setColorScheme(ColorScheme colorScheme) {
|
||||
this.colorScheme = colorScheme;
|
||||
this.colorScheme = Optional.ofNullable(colorScheme);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -721,10 +724,10 @@ public interface BrowserType {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
|
||||
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
|
||||
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setForcedColors(ForcedColors forcedColors) {
|
||||
this.forcedColors = forcedColors;
|
||||
this.forcedColors = Optional.ofNullable(forcedColors);
|
||||
return this;
|
||||
}
|
||||
public LaunchPersistentContextOptions setGeolocation(double latitude, double longitude) {
|
||||
@@ -927,10 +930,11 @@ public interface BrowserType {
|
||||
}
|
||||
/**
|
||||
* Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}.
|
||||
* Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to
|
||||
* {@code "no-preference"}.
|
||||
*/
|
||||
public LaunchPersistentContextOptions setReducedMotion(ReducedMotion reducedMotion) {
|
||||
this.reducedMotion = reducedMotion;
|
||||
this.reducedMotion = Optional.ofNullable(reducedMotion);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -138,52 +138,6 @@ public interface ElementHandle extends JSHandle {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class ClearOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
|
||||
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
|
||||
* inaccessible pages. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean noWaitAfter;
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
* Page.setDefaultTimeout()} methods.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
*/
|
||||
public ClearOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
|
||||
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
|
||||
* inaccessible pages. Defaults to {@code false}.
|
||||
*/
|
||||
public ClearOptions setNoWaitAfter(boolean noWaitAfter) {
|
||||
this.noWaitAfter = noWaitAfter;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
* Page.setDefaultTimeout()} methods.
|
||||
*/
|
||||
public ClearOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class ClickOptions {
|
||||
/**
|
||||
* Defaults to {@code left}.
|
||||
@@ -1330,28 +1284,6 @@ public interface ElementHandle extends JSHandle {
|
||||
* zero timeout disables this.
|
||||
*/
|
||||
void check(CheckOptions options);
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
|
||||
* element, clears it and triggers an {@code input} event after clearing.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, the control will be
|
||||
* cleared instead.
|
||||
*/
|
||||
default void clear() {
|
||||
clear(null);
|
||||
}
|
||||
/**
|
||||
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the
|
||||
* element, clears it and triggers an {@code input} event after clearing.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, the control will be
|
||||
* cleared instead.
|
||||
*/
|
||||
void clear(ClearOptions options);
|
||||
/**
|
||||
* This method clicks the element by performing the following steps:
|
||||
* <ol>
|
||||
|
||||
@@ -243,65 +243,6 @@ public interface Frame {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class ClearOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
|
||||
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
|
||||
* inaccessible pages. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean noWaitAfter;
|
||||
/**
|
||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||
* element, the call throws an exception.
|
||||
*/
|
||||
public Boolean strict;
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
* Page.setDefaultTimeout()} methods.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
*/
|
||||
public ClearOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
|
||||
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
|
||||
* inaccessible pages. Defaults to {@code false}.
|
||||
*/
|
||||
public ClearOptions setNoWaitAfter(boolean noWaitAfter) {
|
||||
this.noWaitAfter = noWaitAfter;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||
* element, the call throws an exception.
|
||||
*/
|
||||
public ClearOptions setStrict(boolean strict) {
|
||||
this.strict = strict;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
* Page.setDefaultTimeout()} methods.
|
||||
*/
|
||||
public ClearOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class ClickOptions {
|
||||
/**
|
||||
* Defaults to {@code left}.
|
||||
@@ -856,13 +797,13 @@ public interface Frame {
|
||||
class GetByAltTextOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByAltTextOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -872,13 +813,13 @@ public interface Frame {
|
||||
class GetByLabelOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByLabelOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -888,13 +829,13 @@ public interface Frame {
|
||||
class GetByPlaceholderOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByPlaceholderOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -903,27 +844,31 @@ public interface Frame {
|
||||
}
|
||||
class GetByRoleOptions {
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls. Available values for
|
||||
* checked are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked">{@code aria-checked}</a>.
|
||||
*/
|
||||
public Boolean checked;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
* An attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-disabled">{@code aria-disabled}</a>.
|
||||
*/
|
||||
public Boolean disabled;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-expanded}.
|
||||
* Whether {@code name} is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when {@code name} is a regular
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-expanded}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded">{@code aria-expanded}</a>.
|
||||
*/
|
||||
public Boolean expanded;
|
||||
/**
|
||||
* A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* Option that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined by ARIA</a>, are matched by role selector.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden">{@code aria-hidden}</a>.
|
||||
@@ -937,27 +882,27 @@ public interface Frame {
|
||||
*/
|
||||
public Integer level;
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
public Object name;
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-pressed}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed">{@code aria-pressed}</a>.
|
||||
*/
|
||||
public Boolean pressed;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-selected}.
|
||||
* An attribute that is usually set by {@code aria-selected}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected">{@code aria-selected}</a>.
|
||||
*/
|
||||
public Boolean selected;
|
||||
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls. Available values for
|
||||
* checked are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked">{@code aria-checked}</a>.
|
||||
*/
|
||||
@@ -966,7 +911,7 @@ public interface Frame {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
* An attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-disabled">{@code aria-disabled}</a>.
|
||||
@@ -976,7 +921,15 @@ public interface Frame {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-expanded}.
|
||||
* Whether {@code name} is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when {@code name} is a regular
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByRoleOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-expanded}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded">{@code aria-expanded}</a>.
|
||||
*/
|
||||
@@ -985,7 +938,7 @@ public interface Frame {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* Option that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined by ARIA</a>, are matched by role selector.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden">{@code aria-hidden}</a>.
|
||||
@@ -1005,7 +958,8 @@ public interface Frame {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
@@ -1014,7 +968,8 @@ public interface Frame {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
@@ -1023,7 +978,7 @@ public interface Frame {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-pressed}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed">{@code aria-pressed}</a>.
|
||||
*/
|
||||
@@ -1032,7 +987,7 @@ public interface Frame {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-selected}.
|
||||
* An attribute that is usually set by {@code aria-selected}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected">{@code aria-selected}</a>.
|
||||
*/
|
||||
@@ -1044,13 +999,13 @@ public interface Frame {
|
||||
class GetByTextOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByTextOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -1060,13 +1015,13 @@ public interface Frame {
|
||||
class GetByTitleOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByTitleOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -2460,36 +2415,6 @@ public interface Frame {
|
||||
*/
|
||||
void check(String selector, CheckOptions options);
|
||||
List<Frame> childFrames();
|
||||
/**
|
||||
* This method waits for an element matching {@code selector}, waits for <a
|
||||
* href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the element, clears it and
|
||||
* triggers an {@code input} event after clearing.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, the control will be
|
||||
* cleared instead.
|
||||
*
|
||||
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See
|
||||
* <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
|
||||
*/
|
||||
default void clear(String selector) {
|
||||
clear(selector, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for an element matching {@code selector}, waits for <a
|
||||
* href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the element, clears it and
|
||||
* triggers an {@code input} event after clearing.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, the control will be
|
||||
* cleared instead.
|
||||
*
|
||||
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See
|
||||
* <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
|
||||
*/
|
||||
void clear(String selector, ClearOptions options);
|
||||
/**
|
||||
* This method clicks an element matching {@code selector} by performing the following steps:
|
||||
* <ol>
|
||||
@@ -3215,7 +3140,34 @@ public interface Frame {
|
||||
*/
|
||||
Locator getByTestId(String testId);
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
@@ -3223,13 +3175,67 @@ public interface Frame {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
Locator getByText(String text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
@@ -3237,7 +3243,34 @@ public interface Frame {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.regex.Pattern;
|
||||
* and locate elements in that iframe. FrameLocator can be created with either {@link Page#frameLocator
|
||||
* Page.frameLocator()} or {@link Locator#frameLocator Locator.frameLocator()} method.
|
||||
* <pre>{@code
|
||||
* Locator locator = page.frameLocator("#my-frame").locator("text=Submit");
|
||||
* Locator locator = page.frameLocator("#my-frame").getByText("Submit");
|
||||
* locator.click();
|
||||
* }</pre>
|
||||
*
|
||||
@@ -52,13 +52,13 @@ public interface FrameLocator {
|
||||
class GetByAltTextOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByAltTextOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -68,13 +68,13 @@ public interface FrameLocator {
|
||||
class GetByLabelOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByLabelOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -84,13 +84,13 @@ public interface FrameLocator {
|
||||
class GetByPlaceholderOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByPlaceholderOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -99,27 +99,31 @@ public interface FrameLocator {
|
||||
}
|
||||
class GetByRoleOptions {
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls. Available values for
|
||||
* checked are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked">{@code aria-checked}</a>.
|
||||
*/
|
||||
public Boolean checked;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
* An attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-disabled">{@code aria-disabled}</a>.
|
||||
*/
|
||||
public Boolean disabled;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-expanded}.
|
||||
* Whether {@code name} is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when {@code name} is a regular
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-expanded}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded">{@code aria-expanded}</a>.
|
||||
*/
|
||||
public Boolean expanded;
|
||||
/**
|
||||
* A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* Option that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined by ARIA</a>, are matched by role selector.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden">{@code aria-hidden}</a>.
|
||||
@@ -133,27 +137,27 @@ public interface FrameLocator {
|
||||
*/
|
||||
public Integer level;
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
public Object name;
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-pressed}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed">{@code aria-pressed}</a>.
|
||||
*/
|
||||
public Boolean pressed;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-selected}.
|
||||
* An attribute that is usually set by {@code aria-selected}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected">{@code aria-selected}</a>.
|
||||
*/
|
||||
public Boolean selected;
|
||||
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls. Available values for
|
||||
* checked are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked">{@code aria-checked}</a>.
|
||||
*/
|
||||
@@ -162,7 +166,7 @@ public interface FrameLocator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
* An attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-disabled">{@code aria-disabled}</a>.
|
||||
@@ -172,7 +176,15 @@ public interface FrameLocator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-expanded}.
|
||||
* Whether {@code name} is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when {@code name} is a regular
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByRoleOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-expanded}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded">{@code aria-expanded}</a>.
|
||||
*/
|
||||
@@ -181,7 +193,7 @@ public interface FrameLocator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* Option that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined by ARIA</a>, are matched by role selector.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden">{@code aria-hidden}</a>.
|
||||
@@ -201,7 +213,8 @@ public interface FrameLocator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
@@ -210,7 +223,8 @@ public interface FrameLocator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
@@ -219,7 +233,7 @@ public interface FrameLocator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-pressed}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed">{@code aria-pressed}</a>.
|
||||
*/
|
||||
@@ -228,7 +242,7 @@ public interface FrameLocator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-selected}.
|
||||
* An attribute that is usually set by {@code aria-selected}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected">{@code aria-selected}</a>.
|
||||
*/
|
||||
@@ -240,13 +254,13 @@ public interface FrameLocator {
|
||||
class GetByTextOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByTextOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -256,13 +270,13 @@ public interface FrameLocator {
|
||||
class GetByTitleOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByTitleOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -457,7 +471,34 @@ public interface FrameLocator {
|
||||
*/
|
||||
Locator getByTestId(String testId);
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
@@ -465,13 +506,67 @@ public interface FrameLocator {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
Locator getByText(String text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
@@ -479,7 +574,34 @@ public interface FrameLocator {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
|
||||
@@ -737,13 +737,13 @@ public interface Locator {
|
||||
class GetByAltTextOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByAltTextOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -753,13 +753,13 @@ public interface Locator {
|
||||
class GetByLabelOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByLabelOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -769,13 +769,13 @@ public interface Locator {
|
||||
class GetByPlaceholderOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByPlaceholderOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -784,27 +784,31 @@ public interface Locator {
|
||||
}
|
||||
class GetByRoleOptions {
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls. Available values for
|
||||
* checked are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked">{@code aria-checked}</a>.
|
||||
*/
|
||||
public Boolean checked;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
* An attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-disabled">{@code aria-disabled}</a>.
|
||||
*/
|
||||
public Boolean disabled;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-expanded}.
|
||||
* Whether {@code name} is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when {@code name} is a regular
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-expanded}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded">{@code aria-expanded}</a>.
|
||||
*/
|
||||
public Boolean expanded;
|
||||
/**
|
||||
* A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* Option that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined by ARIA</a>, are matched by role selector.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden">{@code aria-hidden}</a>.
|
||||
@@ -818,27 +822,27 @@ public interface Locator {
|
||||
*/
|
||||
public Integer level;
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
public Object name;
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-pressed}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed">{@code aria-pressed}</a>.
|
||||
*/
|
||||
public Boolean pressed;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-selected}.
|
||||
* An attribute that is usually set by {@code aria-selected}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected">{@code aria-selected}</a>.
|
||||
*/
|
||||
public Boolean selected;
|
||||
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls. Available values for
|
||||
* checked are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked">{@code aria-checked}</a>.
|
||||
*/
|
||||
@@ -847,7 +851,7 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
* An attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-disabled">{@code aria-disabled}</a>.
|
||||
@@ -857,7 +861,15 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-expanded}.
|
||||
* Whether {@code name} is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when {@code name} is a regular
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByRoleOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-expanded}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded">{@code aria-expanded}</a>.
|
||||
*/
|
||||
@@ -866,7 +878,7 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* Option that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined by ARIA</a>, are matched by role selector.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden">{@code aria-hidden}</a>.
|
||||
@@ -886,7 +898,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
@@ -895,7 +908,8 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
@@ -904,7 +918,7 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-pressed}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed">{@code aria-pressed}</a>.
|
||||
*/
|
||||
@@ -913,7 +927,7 @@ public interface Locator {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-selected}.
|
||||
* An attribute that is usually set by {@code aria-selected}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected">{@code aria-selected}</a>.
|
||||
*/
|
||||
@@ -925,13 +939,13 @@ public interface Locator {
|
||||
class GetByTextOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByTextOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -941,13 +955,13 @@ public interface Locator {
|
||||
class GetByTitleOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByTitleOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -2677,7 +2691,34 @@ public interface Locator {
|
||||
*/
|
||||
Locator getByTestId(String testId);
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
@@ -2685,13 +2726,67 @@ public interface Locator {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
Locator getByText(String text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
@@ -2699,7 +2794,34 @@ public interface Locator {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
|
||||
@@ -504,65 +504,6 @@ public interface Page extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class ClearOptions {
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
*/
|
||||
public Boolean force;
|
||||
/**
|
||||
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
|
||||
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
|
||||
* inaccessible pages. Defaults to {@code false}.
|
||||
*/
|
||||
public Boolean noWaitAfter;
|
||||
/**
|
||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||
* element, the call throws an exception.
|
||||
*/
|
||||
public Boolean strict;
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
* Page.setDefaultTimeout()} methods.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Whether to bypass the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks. Defaults to
|
||||
* {@code false}.
|
||||
*/
|
||||
public ClearOptions setForce(boolean force) {
|
||||
this.force = force;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
|
||||
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
|
||||
* inaccessible pages. Defaults to {@code false}.
|
||||
*/
|
||||
public ClearOptions setNoWaitAfter(boolean noWaitAfter) {
|
||||
this.noWaitAfter = noWaitAfter;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
|
||||
* element, the call throws an exception.
|
||||
*/
|
||||
public ClearOptions setStrict(boolean strict) {
|
||||
this.strict = strict;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by
|
||||
* using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout
|
||||
* Page.setDefaultTimeout()} methods.
|
||||
*/
|
||||
public ClearOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class ClickOptions {
|
||||
/**
|
||||
* Defaults to {@code left}.
|
||||
@@ -1204,13 +1145,13 @@ public interface Page extends AutoCloseable {
|
||||
class GetByAltTextOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByAltTextOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -1220,13 +1161,13 @@ public interface Page extends AutoCloseable {
|
||||
class GetByLabelOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByLabelOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -1236,13 +1177,13 @@ public interface Page extends AutoCloseable {
|
||||
class GetByPlaceholderOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByPlaceholderOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -1251,27 +1192,31 @@ public interface Page extends AutoCloseable {
|
||||
}
|
||||
class GetByRoleOptions {
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls. Available values for
|
||||
* checked are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked">{@code aria-checked}</a>.
|
||||
*/
|
||||
public Boolean checked;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
* An attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-disabled">{@code aria-disabled}</a>.
|
||||
*/
|
||||
public Boolean disabled;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-expanded}.
|
||||
* Whether {@code name} is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when {@code name} is a regular
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-expanded}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded">{@code aria-expanded}</a>.
|
||||
*/
|
||||
public Boolean expanded;
|
||||
/**
|
||||
* A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* Option that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined by ARIA</a>, are matched by role selector.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden">{@code aria-hidden}</a>.
|
||||
@@ -1285,27 +1230,27 @@ public interface Page extends AutoCloseable {
|
||||
*/
|
||||
public Integer level;
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
public Object name;
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-pressed}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed">{@code aria-pressed}</a>.
|
||||
*/
|
||||
public Boolean pressed;
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-selected}.
|
||||
* An attribute that is usually set by {@code aria-selected}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected">{@code aria-selected}</a>.
|
||||
*/
|
||||
public Boolean selected;
|
||||
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls. Available values for
|
||||
* checked are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-checked} or native {@code <input type=checkbox>} controls.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-checked">{@code aria-checked}</a>.
|
||||
*/
|
||||
@@ -1314,7 +1259,7 @@ public interface Page extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
* An attribute that is usually set by {@code aria-disabled} or {@code disabled}.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-disabled">{@code aria-disabled}</a>.
|
||||
@@ -1324,7 +1269,15 @@ public interface Page extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-expanded}.
|
||||
* Whether {@code name} is matched exactly: case-sensitive and whole-string. Defaults to false. Ignored when {@code name} is a regular
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByRoleOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-expanded}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-expanded">{@code aria-expanded}</a>.
|
||||
*/
|
||||
@@ -1333,7 +1286,7 @@ public interface Page extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* Option that controls whether hidden elements are matched. By default, only non-hidden elements, as <a
|
||||
* href="https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion">defined by ARIA</a>, are matched by role selector.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-hidden">{@code aria-hidden}</a>.
|
||||
@@ -1353,7 +1306,8 @@ public interface Page extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
@@ -1362,7 +1316,8 @@ public interface Page extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A string attribute that matches <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
* Option to match the <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. By default,
|
||||
* matching is case-insensitive and searches for a substring, use {@code exact} to control this behavior.
|
||||
*
|
||||
* <p> Learn more about <a href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*/
|
||||
@@ -1371,7 +1326,7 @@ public interface Page extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
|
||||
* An attribute that is usually set by {@code aria-pressed}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-pressed">{@code aria-pressed}</a>.
|
||||
*/
|
||||
@@ -1380,7 +1335,7 @@ public interface Page extends AutoCloseable {
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* A boolean attribute that is usually set by {@code aria-selected}.
|
||||
* An attribute that is usually set by {@code aria-selected}.
|
||||
*
|
||||
* <p> Learn more about <a href="https://www.w3.org/TR/wai-aria-1.2/#aria-selected">{@code aria-selected}</a>.
|
||||
*/
|
||||
@@ -1392,13 +1347,13 @@ public interface Page extends AutoCloseable {
|
||||
class GetByTextOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByTextOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -1408,13 +1363,13 @@ public interface Page extends AutoCloseable {
|
||||
class GetByTitleOptions {
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public Boolean exact;
|
||||
|
||||
/**
|
||||
* Whether to find an exact match: case-sensitive and whole-string. Default to false. Ignored when locating by a regular
|
||||
* expression.
|
||||
* expression. Note that exact match still trims whitespace.
|
||||
*/
|
||||
public GetByTitleOptions setExact(boolean exact) {
|
||||
this.exact = exact;
|
||||
@@ -3637,36 +3592,6 @@ public interface Page extends AutoCloseable {
|
||||
* <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
|
||||
*/
|
||||
void check(String selector, CheckOptions options);
|
||||
/**
|
||||
* This method waits for an element matching {@code selector}, waits for <a
|
||||
* href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the element, clears it and
|
||||
* triggers an {@code input} event after clearing. Note that you can pass an empty string to clear the input field.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, the control will be
|
||||
* cleared instead.
|
||||
*
|
||||
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See
|
||||
* <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
|
||||
*/
|
||||
default void clear(String selector) {
|
||||
clear(selector, null);
|
||||
}
|
||||
/**
|
||||
* This method waits for an element matching {@code selector}, waits for <a
|
||||
* href="https://playwright.dev/java/docs/actionability">actionability</a> checks, focuses the element, clears it and
|
||||
* triggers an {@code input} event after clearing. Note that you can pass an empty string to clear the input field.
|
||||
*
|
||||
* <p> If the target element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws an error.
|
||||
* However, if the element is inside the {@code <label>} element that has an associated <a
|
||||
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, the control will be
|
||||
* cleared instead.
|
||||
*
|
||||
* @param selector A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used. See
|
||||
* <a href="https://playwright.dev/java/docs/selectors">working with selectors</a> for more details.
|
||||
*/
|
||||
void clear(String selector, ClearOptions options);
|
||||
/**
|
||||
* This method clicks an element matching {@code selector} by performing the following steps:
|
||||
* <ol>
|
||||
@@ -4710,7 +4635,34 @@ public interface Page extends AutoCloseable {
|
||||
*/
|
||||
Locator getByTestId(String testId);
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
@@ -4718,13 +4670,67 @@ public interface Page extends AutoCloseable {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
Locator getByText(String text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
@@ -4732,7 +4738,34 @@ public interface Page extends AutoCloseable {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text.
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
* // Matches <span>
|
||||
* page.getByText("world")
|
||||
*
|
||||
* // Matches first <div>
|
||||
* page.getByText("Hello world")
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
|
||||
*
|
||||
* // Matches both <div>s
|
||||
* page.getByText(Pattern.compile("Hello"))
|
||||
*
|
||||
* // Matches second <div>
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text content. For example,
|
||||
* locating by text {@code "Log in"} matches {@code <input type=button value="Log in">}.
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,15 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
||||
private boolean isClosedOrClosing;
|
||||
final Map<String, BindingCallback> bindings = new HashMap<>();
|
||||
PageImpl ownerPage;
|
||||
private final ListenerCollection<EventType> listeners = new ListenerCollection<>();
|
||||
private static final Map<EventType, String> eventSubscriptions() {
|
||||
Map<EventType, String> result = new HashMap<>();
|
||||
result.put(EventType.REQUEST, "request");
|
||||
result.put(EventType.RESPONSE, "response");
|
||||
result.put(EventType.REQUESTFINISHED, "requestFinished");
|
||||
result.put(EventType.REQUESTFAILED, "requestFailed");
|
||||
return result;
|
||||
}
|
||||
private final ListenerCollection<EventType> listeners = new ListenerCollection<>(eventSubscriptions(), this);
|
||||
final TimeoutSettings timeoutSettings = new TimeoutSettings();
|
||||
Path videosDir;
|
||||
URL baseUrl;
|
||||
|
||||
@@ -122,11 +122,6 @@ public class ElementHandleImpl extends JSHandleImpl implements ElementHandle {
|
||||
withLogging("ElementHandle.check", () -> checkImpl(options));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(ClearOptions options) {
|
||||
withLogging("ElementHandle.clear", () -> fillImpl("", convertType(options, FillOptions.class)));
|
||||
}
|
||||
|
||||
private void checkImpl(CheckOptions options) {
|
||||
if (options == null) {
|
||||
options = new CheckOptions();
|
||||
|
||||
@@ -242,15 +242,6 @@ public class FrameImpl extends ChannelOwner implements Frame {
|
||||
return new ArrayList<>(childFrames);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(String selector, ClearOptions options) {
|
||||
withLogging("Frame.clear", () -> clearImpl(selector, options));
|
||||
}
|
||||
|
||||
void clearImpl(String selector, ClearOptions options) {
|
||||
fillImpl(selector, "", convertType(options, FillOptions.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void click(String selector, ClickOptions options) {
|
||||
withLogging("Frame.click", () -> clickImpl(selector, options));
|
||||
|
||||
@@ -16,14 +16,23 @@
|
||||
|
||||
package com.microsoft.playwright.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
class ListenerCollection <EventType> {
|
||||
private final HashMap<EventType, List<Consumer<?>>> listeners = new HashMap<>();
|
||||
private final Map<EventType, String> eventSubscriptions;
|
||||
private final ChannelOwner channelOwner;
|
||||
|
||||
ListenerCollection() {
|
||||
this(null, null);
|
||||
}
|
||||
ListenerCollection(Map<EventType, String> eventSubscriptions, ChannelOwner channelOwner) {
|
||||
this.eventSubscriptions = eventSubscriptions;
|
||||
this.channelOwner = channelOwner;
|
||||
}
|
||||
|
||||
<T> void notify(EventType eventType, T param) {
|
||||
List<Consumer<?>> list = listeners.get(eventType);
|
||||
@@ -41,6 +50,7 @@ class ListenerCollection <EventType> {
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
listeners.put(type, list);
|
||||
updateSubscription(type, true);
|
||||
}
|
||||
list.add(listener);
|
||||
}
|
||||
@@ -52,6 +62,7 @@ class ListenerCollection <EventType> {
|
||||
}
|
||||
list.removeAll(Collections.singleton(listener));
|
||||
if (list.isEmpty()) {
|
||||
updateSubscription(type, false);
|
||||
listeners.remove(type);
|
||||
}
|
||||
}
|
||||
@@ -59,4 +70,18 @@ class ListenerCollection <EventType> {
|
||||
boolean hasListeners(EventType type) {
|
||||
return listeners.containsKey(type);
|
||||
}
|
||||
|
||||
private void updateSubscription(EventType eventType, boolean enabled) {
|
||||
if (eventSubscriptions == null) {
|
||||
return;
|
||||
}
|
||||
String protocolEvent = eventSubscriptions.get(eventType);
|
||||
if (protocolEvent == null) {
|
||||
return;
|
||||
}
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("event", protocolEvent);
|
||||
params.addProperty("enabled", enabled);
|
||||
channelOwner.sendMessageAsync("updateSubscription", params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class LocatorUtils {
|
||||
if (options.name != null) {
|
||||
String name;
|
||||
if (options.name instanceof String) {
|
||||
name = escapeForAttributeSelector((String) options.name, false);
|
||||
name = escapeForAttributeSelector((String) options.name, options.exact != null && options.exact);
|
||||
} else if (options.name instanceof Pattern) {
|
||||
name = toJsRegExp((Pattern) options.name);
|
||||
} else {
|
||||
|
||||
@@ -48,23 +48,16 @@ public class PageImpl extends ChannelOwner implements Page {
|
||||
private ViewportSize viewport;
|
||||
private final Router routes = new Router();
|
||||
private final Set<FrameImpl> frames = new LinkedHashSet<>();
|
||||
final ListenerCollection<EventType> listeners = new ListenerCollection<EventType>() {
|
||||
@Override
|
||||
void add(EventType eventType, Consumer<?> listener) {
|
||||
if (eventType == EventType.FILECHOOSER) {
|
||||
willAddFileChooserListener();
|
||||
}
|
||||
super.add(eventType, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
void remove(EventType eventType, Consumer<?> listener) {
|
||||
super.remove(eventType, listener);
|
||||
if (eventType == EventType.FILECHOOSER) {
|
||||
didRemoveFileChooserListener();
|
||||
}
|
||||
}
|
||||
};
|
||||
private static final Map<EventType, String> eventSubscriptions() {
|
||||
Map<EventType, String> result = new HashMap<>();
|
||||
result.put(EventType.REQUEST, "request");
|
||||
result.put(EventType.RESPONSE, "response");
|
||||
result.put(EventType.REQUESTFINISHED, "requestFinished");
|
||||
result.put(EventType.REQUESTFAILED, "requestFailed");
|
||||
result.put(EventType.FILECHOOSER, "fileChooser");
|
||||
return result;
|
||||
}
|
||||
final ListenerCollection<EventType> listeners = new ListenerCollection<EventType>(eventSubscriptions(), this);
|
||||
final Map<String, BindingCallback> bindings = new HashMap<>();
|
||||
BrowserContextImpl ownedContext;
|
||||
private boolean isClosed;
|
||||
@@ -232,24 +225,6 @@ public class PageImpl extends ChannelOwner implements Page {
|
||||
listeners.notify(EventType.CLOSE, this);
|
||||
}
|
||||
|
||||
private void willAddFileChooserListener() {
|
||||
if (!listeners.hasListeners(EventType.FILECHOOSER)) {
|
||||
updateFileChooserInterception(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void didRemoveFileChooserListener() {
|
||||
if (!listeners.hasListeners(EventType.FILECHOOSER)) {
|
||||
updateFileChooserInterception(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateFileChooserInterception(boolean enabled) {
|
||||
JsonObject params = new JsonObject();
|
||||
params.addProperty("intercepted", enabled);
|
||||
sendMessage("setFileChooserInterceptedNoReply", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(Consumer<Page> handler) {
|
||||
listeners.add(EventType.CLOSE, handler);
|
||||
@@ -619,12 +594,6 @@ public class PageImpl extends ChannelOwner implements Page {
|
||||
() -> mainFrame.checkImpl(selector, convertType(options, Frame.CheckOptions.class)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear(String selector, ClearOptions options) {
|
||||
withLogging("Page.clear",
|
||||
() -> mainFrame.clearImpl(selector, convertType(options, Frame.ClearOptions.class)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void click(String selector, ClickOptions options) {
|
||||
withLogging("Page.click",
|
||||
|
||||
@@ -378,7 +378,7 @@ class Serialization {
|
||||
public JsonElement serialize(Optional<?> src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
assert isSupported(typeOfSrc) : "Unexpected optional type: " + typeOfSrc.getTypeName();
|
||||
if (!src.isPresent()) {
|
||||
return new JsonPrimitive("null");
|
||||
return new JsonPrimitive("no-override");
|
||||
}
|
||||
return context.serialize(src.get());
|
||||
}
|
||||
|
||||
@@ -83,14 +83,4 @@ public class TestElementHandleMisc extends TestBase {
|
||||
input.setChecked(false);
|
||||
assertEquals(false, page.evaluate("checkbox.checked"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldClearInput() {
|
||||
page.navigate(server.PREFIX + "/input/textarea.html");
|
||||
ElementHandle handle = page.querySelector("input");
|
||||
handle.fill("some value");
|
||||
assertEquals("some value", page.evaluate("() => window['result']"));
|
||||
handle.clear();
|
||||
assertEquals("", page.evaluate("() => window['result']"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class TestLocatorFrame extends TestBase {
|
||||
PlaywrightException e = assertThrows(PlaywrightException.class, () -> {
|
||||
page.frameLocator("iframe").locator("span").click(new Locator.ClickOptions().setTimeout(300));
|
||||
});
|
||||
assertTrue(e.getMessage().contains("waiting for frame \"iframe\""), e.getMessage());
|
||||
assertTrue(e.getMessage().contains("waiting for frameLocator('iframe')"), e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -228,7 +228,7 @@ public class TestLocatorFrame extends TestBase {
|
||||
page.navigate(server.EMPTY_PAGE);
|
||||
Locator button = page.locator("body").frameLocator("iframe").locator("button");
|
||||
PlaywrightException e = assertThrows(PlaywrightException.class, () -> button.waitFor());
|
||||
assertTrue(e.getMessage().contains("Error: strict mode violation: \"body >> iframe\" resolved to 3 elements"), e.getMessage());
|
||||
assertTrue(e.getMessage().contains("Error: strict mode violation: locator(\"body\").locator(\"iframe\") resolved to 3 elements"), e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -244,23 +244,6 @@ public class TestPageFill extends TestBase {
|
||||
assertEquals("", page.inputValue("input"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldThrowOnUnsupportedInputsWhenClear() {
|
||||
page.navigate(server.PREFIX + "/input/textarea.html");
|
||||
for (String type : new String[]{"button", "checkbox", "file", "image", "radio", "reset", "submit"}) {
|
||||
page.evalOnSelector("input", "(input, type) => input.setAttribute('type', type)", type);
|
||||
PlaywrightException e = assertThrows(PlaywrightException.class, () -> page.clear("input"));
|
||||
assertTrue(e.getMessage().contains("input of type \"" + type + "\" cannot be filled"), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldThrowNiceErrorWithoutInjectedScriptStackWhenElementIsNotAnInputWhenClear() {
|
||||
page.navigate(server.PREFIX + "/input/textarea.html");
|
||||
PlaywrightException e = assertThrows(PlaywrightException.class, () -> page.clear("body"));
|
||||
assertTrue(e.getMessage().contains("Error: Element is not an <input>, <textarea> or [contenteditable] element\n=========================== logs"), e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldBeAbleToClearUsingFill() {
|
||||
page.navigate(server.PREFIX + "/input/textarea.html");
|
||||
@@ -269,13 +252,4 @@ public class TestPageFill extends TestBase {
|
||||
page.fill("input", "");
|
||||
assertEquals("", page.evaluate("() => window['result']"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldBeAbleToClearUsingClear() {
|
||||
page.navigate(server.PREFIX + "/input/textarea.html");
|
||||
page.fill("input", "some value");
|
||||
assertEquals("some value", page.evaluate("() => window['result']"));
|
||||
page.clear("input");
|
||||
assertEquals("", page.evaluate("() => window['result']"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.microsoft.playwright;
|
||||
|
||||
import com.microsoft.playwright.options.AriaRole;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class TestSelectorsGetBy extends TestBase {
|
||||
@Test
|
||||
@@ -139,4 +140,35 @@ public class TestSelectorsGetBy extends TestBase {
|
||||
assertThat(page.getByAltText("hello my\nworld")).hasAttribute("id", "control");
|
||||
assertThat(page.getByTitle("hello my\nworld")).hasAttribute("id", "control");
|
||||
}
|
||||
|
||||
@Test
|
||||
void getByRoleEscaping() {
|
||||
page.setContent("<a href=\"https://playwright.dev\">issues 123</a>\n" +
|
||||
" <a href=\"https://playwright.dev\">he llo 56</a>\n" +
|
||||
" <button>Click me</button>");
|
||||
assertEquals(
|
||||
asList("<button>Click me</button>"),
|
||||
page.getByRole(AriaRole.BUTTON).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(
|
||||
asList("<a href=\"https://playwright.dev\">issues 123</a>", "<a href=\"https://playwright.dev\">he llo 56</a>"),
|
||||
page.getByRole(AriaRole.LINK).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(
|
||||
asList("<a href=\"https://playwright.dev\">issues 123</a>"),
|
||||
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("issues 123")).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(
|
||||
asList("<a href=\"https://playwright.dev\">issues 123</a>"),
|
||||
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("sues")).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(
|
||||
asList("<a href=\"https://playwright.dev\">he llo 56</a>"),
|
||||
page.getByRole( AriaRole.LINK, new Page.GetByRoleOptions().setName(" he \n llo ")).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(
|
||||
asList(),
|
||||
page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("issues")).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(
|
||||
asList(),
|
||||
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("sues").setExact(true)).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(
|
||||
asList("<a href=\"https://playwright.dev\">he llo 56</a>"),
|
||||
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(" he \n llo 56 ").setExact(true)).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,16 +297,19 @@ public class TestSelectorsRole extends TestBase {
|
||||
|
||||
@Test
|
||||
void shouldSupportName() {
|
||||
page.setContent("<div role=\"button\" aria-label=\"Hello\"></div>\n" +
|
||||
page.setContent("<div role=\"button\" aria-label=\" Hello \"></div>\n" +
|
||||
" <div role=\"button\" aria-label=\"Hallo\"></div>\n" +
|
||||
" <div role=\"button\" aria-label=\"Hello\" aria-hidden=\"true\"></div>\n" +
|
||||
" <div role=\"button\" aria-label=\"123\" aria-hidden=\"true\"></div>\n" +
|
||||
" <div role=\"button\" aria-label='foo\"bar' aria-hidden=\"true\"></div>");
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>"
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>"
|
||||
), page.locator("role=button[name='Hello']").evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>"
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>"
|
||||
), page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(" \n Hello ")).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>"
|
||||
), page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Hello")).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
|
||||
assertEquals(asList(
|
||||
@@ -314,38 +317,38 @@ public class TestSelectorsRole extends TestBase {
|
||||
), page.locator("role=button[name*='all']").evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>",
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>",
|
||||
"<div role=\"button\" aria-label=\"Hallo\"></div>"
|
||||
), page.locator("role=button[name=/^H[ae]llo$/]").evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>",
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>",
|
||||
"<div role=\"button\" aria-label=\"Hallo\"></div>"
|
||||
), page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(Pattern.compile("^H[ae]llo$"))).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>",
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>",
|
||||
"<div role=\"button\" aria-label=\"Hallo\"></div>"
|
||||
), page.locator("role=button[name=/h.*o/i]").evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>",
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>",
|
||||
"<div role=\"button\" aria-label=\"Hallo\"></div>"
|
||||
), page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName(Pattern.compile("h.*o", Pattern.CASE_INSENSITIVE))).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>",
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>",
|
||||
"<div role=\"button\" aria-label=\"Hello\" aria-hidden=\"true\"></div>"
|
||||
), page.locator("role=button[name='Hello'][include-hidden]").evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>",
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>",
|
||||
"<div role=\"button\" aria-label=\"Hello\" aria-hidden=\"true\"></div>"
|
||||
), page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Hello").setIncludeHidden(true)).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>",
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>",
|
||||
"<div role=\"button\" aria-label=\"Hello\" aria-hidden=\"true\"></div>"
|
||||
), page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("hello").setIncludeHidden(true)).evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"Hello\"></div>"
|
||||
"<div role=\"button\" aria-label=\" Hello \"></div>"
|
||||
), page.locator("role=button[name=Hello]").evaluateAll("els => els.map(e => e.outerHTML)"));
|
||||
assertEquals(asList(
|
||||
"<div role=\"button\" aria-label=\"123\" aria-hidden=\"true\"></div>"
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.28.0-alpha-oct-26-2022
|
||||
1.29.0-alpha-1668454236000
|
||||
|
||||
Reference in New Issue
Block a user