diff --git a/README.md b/README.md index 8ff1b91a..6413d8b0 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 106.0.5249.30 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 107.0.5304.18 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 16.0 | ✅ | ✅ | ✅ | -| Firefox 104.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Firefox 105.0.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Headless execution is supported for all the browsers on all platforms. Check out [system requirements](https://playwright.dev/java/docs/next/intro/#system-requirements) for details. diff --git a/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java b/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java index 6570d532..c4810ab5 100644 --- a/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java @@ -86,6 +86,31 @@ public interface APIRequestContext { * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update * context cookies from the response. The method will automatically follow redirects. * + *
JSON objects can be passed directly to the request: + *
{@code
+ * Map data = new HashMap();
+ * data.put("title", "Book Title");
+ * data.put("body", "John Doe");
+ * request.fetch("https://example.com/api/createBook", RequestOptions.create().setMethod("post").setData(data));
+ * }
+ *
+ * The common way to send file(s) in the body of a request is to encode it as form fields with {@code multipart/form-data} + * encoding. You can achieve that with Playwright API like this: + *
{@code
+ * // Pass file path to the form data constructor:
+ * Path file = Paths.get("team.csv");
+ * APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMethod("post").setMultipart(
+ * FormData.create().set("fileField", file)));
+ *
+ * // Or you can pass the file content directly as FilePayload object:
+ * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
+ * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
+ * APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMethod("post").setMultipart(
+ * FormData.create().set("fileField", filePayload)));
+ * }
+ *
* @param urlOrRequest Target URL or Request to get all parameters from.
*/
default APIResponse fetch(String urlOrRequest) {
@@ -95,6 +120,31 @@ public interface APIRequestContext {
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
* context cookies from the response. The method will automatically follow redirects.
*
+ * JSON objects can be passed directly to the request: + *
{@code
+ * Map data = new HashMap();
+ * data.put("title", "Book Title");
+ * data.put("body", "John Doe");
+ * request.fetch("https://example.com/api/createBook", RequestOptions.create().setMethod("post").setData(data));
+ * }
+ *
+ * The common way to send file(s) in the body of a request is to encode it as form fields with {@code multipart/form-data} + * encoding. You can achieve that with Playwright API like this: + *
{@code
+ * // Pass file path to the form data constructor:
+ * Path file = Paths.get("team.csv");
+ * APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMethod("post").setMultipart(
+ * FormData.create().set("fileField", file)));
+ *
+ * // Or you can pass the file content directly as FilePayload object:
+ * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
+ * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
+ * APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMethod("post").setMultipart(
+ * FormData.create().set("fileField", filePayload)));
+ * }
+ *
* @param urlOrRequest Target URL or Request to get all parameters from.
* @param params Optional request parameters.
*/
@@ -103,6 +153,31 @@ public interface APIRequestContext {
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
* context cookies from the response. The method will automatically follow redirects.
*
+ * JSON objects can be passed directly to the request: + *
{@code
+ * Map data = new HashMap();
+ * data.put("title", "Book Title");
+ * data.put("body", "John Doe");
+ * request.fetch("https://example.com/api/createBook", RequestOptions.create().setMethod("post").setData(data));
+ * }
+ *
+ * The common way to send file(s) in the body of a request is to encode it as form fields with {@code multipart/form-data} + * encoding. You can achieve that with Playwright API like this: + *
{@code
+ * // Pass file path to the form data constructor:
+ * Path file = Paths.get("team.csv");
+ * APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMethod("post").setMultipart(
+ * FormData.create().set("fileField", file)));
+ *
+ * // Or you can pass the file content directly as FilePayload object:
+ * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
+ * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
+ * APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMethod("post").setMultipart(
+ * FormData.create().set("fileField", filePayload)));
+ * }
+ *
* @param urlOrRequest Target URL or Request to get all parameters from.
*/
default APIResponse fetch(Request urlOrRequest) {
@@ -112,6 +187,31 @@ public interface APIRequestContext {
* Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
* context cookies from the response. The method will automatically follow redirects.
*
+ * JSON objects can be passed directly to the request: + *
{@code
+ * Map data = new HashMap();
+ * data.put("title", "Book Title");
+ * data.put("body", "John Doe");
+ * request.fetch("https://example.com/api/createBook", RequestOptions.create().setMethod("post").setData(data));
+ * }
+ *
+ * The common way to send file(s) in the body of a request is to encode it as form fields with {@code multipart/form-data} + * encoding. You can achieve that with Playwright API like this: + *
{@code
+ * // Pass file path to the form data constructor:
+ * Path file = Paths.get("team.csv");
+ * APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMethod("post").setMultipart(
+ * FormData.create().set("fileField", file)));
+ *
+ * // Or you can pass the file content directly as FilePayload object:
+ * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
+ * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
+ * APIResponse response = request.fetch("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMethod("post").setMultipart(
+ * FormData.create().set("fileField", filePayload)));
+ * }
+ *
* @param urlOrRequest Target URL or Request to get all parameters from.
* @param params Optional request parameters.
*/
@@ -121,6 +221,13 @@ public interface APIRequestContext {
* response. The method will populate request cookies from the context and update context cookies from the response. The
* method will automatically follow redirects.
*
+ * Request parameters can be configured with {@code params} option, they will be serialized into the URL search parameters: + *
{@code
+ * request.get("https://example.com/api/getText", RequestOptions.create()
+ * .setQueryParam("isbn", "1234")
+ * .setQueryParam("page", 23));
+ * }
+ *
* @param url Target URL.
*/
default APIResponse get(String url) {
@@ -131,6 +238,13 @@ public interface APIRequestContext {
* response. The method will populate request cookies from the context and update context cookies from the response. The
* method will automatically follow redirects.
*
+ * Request parameters can be configured with {@code params} option, they will be serialized into the URL search parameters: + *
{@code
+ * request.get("https://example.com/api/getText", RequestOptions.create()
+ * .setQueryParam("isbn", "1234")
+ * .setQueryParam("page", 23));
+ * }
+ *
* @param url Target URL.
* @param params Optional request parameters.
*/
@@ -178,6 +292,39 @@ public interface APIRequestContext {
* response. The method will populate request cookies from the context and update context cookies from the response. The
* method will automatically follow redirects.
*
+ * JSON objects can be passed directly to the request: + *
{@code
+ * Map data = new HashMap();
+ * data.put("title", "Book Title");
+ * data.put("body", "John Doe");
+ * request.post("https://example.com/api/createBook", RequestOptions.create().setData(data));
+ * }
+ *
+ * To send form data to the server use {@code form} option. Its value will be encoded into the request body with + * {@code application/x-www-form-urlencoded} encoding (see below how to use {@code multipart/form-data} form encoding to send files): + *
{@code
+ * request.post("https://example.com/api/findBook", RequestOptions.create().setForm(
+ * FormData.create().set("title", "Book Title").set("body", "John Doe")
+ * ));
+ * }
+ *
+ * The common way to send file(s) in the body of a request is to upload them as form fields with {@code multipart/form-data} + * encoding. You can achieve that with Playwright API like this: + *
{@code
+ * // Pass file path to the form data constructor:
+ * Path file = Paths.get("team.csv");
+ * APIResponse response = request.post("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMultipart(
+ * FormData.create().set("fileField", file)));
+ *
+ * // Or you can pass the file content directly as FilePayload object:
+ * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
+ * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
+ * APIResponse response = request.post("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMultipart(
+ * FormData.create().set("fileField", filePayload)));
+ * }
+ *
* @param url Target URL.
*/
default APIResponse post(String url) {
@@ -188,6 +335,39 @@ public interface APIRequestContext {
* response. The method will populate request cookies from the context and update context cookies from the response. The
* method will automatically follow redirects.
*
+ * JSON objects can be passed directly to the request: + *
{@code
+ * Map data = new HashMap();
+ * data.put("title", "Book Title");
+ * data.put("body", "John Doe");
+ * request.post("https://example.com/api/createBook", RequestOptions.create().setData(data));
+ * }
+ *
+ * To send form data to the server use {@code form} option. Its value will be encoded into the request body with + * {@code application/x-www-form-urlencoded} encoding (see below how to use {@code multipart/form-data} form encoding to send files): + *
{@code
+ * request.post("https://example.com/api/findBook", RequestOptions.create().setForm(
+ * FormData.create().set("title", "Book Title").set("body", "John Doe")
+ * ));
+ * }
+ *
+ * The common way to send file(s) in the body of a request is to upload them as form fields with {@code multipart/form-data} + * encoding. You can achieve that with Playwright API like this: + *
{@code
+ * // Pass file path to the form data constructor:
+ * Path file = Paths.get("team.csv");
+ * APIResponse response = request.post("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMultipart(
+ * FormData.create().set("fileField", file)));
+ *
+ * // Or you can pass the file content directly as FilePayload object:
+ * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
+ * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
+ * APIResponse response = request.post("https://example.com/api/uploadTeamList",
+ * RequestOptions.create().setMultipart(
+ * FormData.create().set("fileField", filePayload)));
+ * }
+ *
* @param url Target URL.
* @param params Optional request parameters.
*/
diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java
index acb80d75..4a38dbda 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Browser.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java
@@ -143,7 +143,7 @@ public interface Browser extends AutoCloseable {
public Proxy proxy;
/**
* Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If {@code attach}
- * is specified, resources are persistet as separate files and all of these files are archived along with the HAR file.
+ * is specified, resources are persisted as separate files and all of these files are archived along with the HAR file.
* Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification.
*/
public HarContentPolicy recordHarContent;
@@ -381,7 +381,7 @@ public interface Browser extends AutoCloseable {
}
/**
* Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If {@code attach}
- * is specified, resources are persistet as separate files and all of these files are archived along with the HAR file.
+ * is specified, resources are persisted as separate files and all of these files are archived along with the HAR file.
* Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification.
*/
public NewContextOptions setRecordHarContent(HarContentPolicy recordHarContent) {
@@ -623,7 +623,7 @@ public interface Browser extends AutoCloseable {
public Proxy proxy;
/**
* Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If {@code attach}
- * is specified, resources are persistet as separate files and all of these files are archived along with the HAR file.
+ * is specified, resources are persisted as separate files and all of these files are archived along with the HAR file.
* Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification.
*/
public HarContentPolicy recordHarContent;
@@ -861,7 +861,7 @@ public interface Browser extends AutoCloseable {
}
/**
* Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If {@code attach}
- * is specified, resources are persistet as separate files and all of these files are archived along with the HAR file.
+ * is specified, resources are persisted as separate files and all of these files are archived along with the HAR file.
* Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification.
*/
public NewPageOptions setRecordHarContent(HarContentPolicy recordHarContent) {
diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java
index b1ec9612..8f4f54b8 100644
--- a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java
+++ b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java
@@ -404,7 +404,7 @@ public interface BrowserContext extends AutoCloseable {
* "\n" +
* "\n" +
* "");
- * page.locator("button").click();
+ * page.getByRole("button").click();
* }
* }
* }
@@ -463,7 +463,7 @@ public interface BrowserContext extends AutoCloseable {
* "\n" +
* "\n" +
* "");
- * page.locator("button").click();
+ * page.getByRole("button").click();
* }
* }
* }
@@ -533,7 +533,7 @@ public interface BrowserContext extends AutoCloseable {
* "\n" +
* "\n" +
* "\n");
- * page.locator("button").click();
+ * page.getByRole("button").click();
* }
* }
* }
diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java
index 885b98ce..78606ae1 100644
--- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java
+++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java
@@ -515,7 +515,7 @@ public interface BrowserType {
public Proxy proxy;
/**
* Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If {@code attach}
- * is specified, resources are persistet as separate files and all of these files are archived along with the HAR file.
+ * is specified, resources are persisted as separate files and all of these files are archived along with the HAR file.
* Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification.
*/
public HarContentPolicy recordHarContent;
@@ -861,7 +861,7 @@ public interface BrowserType {
}
/**
* Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If {@code attach}
- * is specified, resources are persistet as separate files and all of these files are archived along with the HAR file.
+ * is specified, resources are persisted as separate files and all of these files are archived along with the HAR file.
* Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification.
*/
public LaunchPersistentContextOptions setRecordHarContent(HarContentPolicy recordHarContent) {
diff --git a/playwright/src/main/java/com/microsoft/playwright/Download.java b/playwright/src/main/java/com/microsoft/playwright/Download.java
index 220f36be..3a74d7eb 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Download.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Download.java
@@ -27,14 +27,8 @@ import java.nio.file.Path;
* Download event is emitted once the download starts. Download path becomes available once download completes: *
{@code
* // wait for download to start
- * Download download = page.waitForDownload(() -> page.locator("a").click());
- * // wait for download to complete
- * Path path = download.path();
- * }
- * {@code
- * // wait for download to start
* Download download = page.waitForDownload(() -> {
- * page.locator("a").click();
+ * page.getByText("Download file").click();
* });
* // wait for download to complete
* Path path = download.path();
diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java
index 0e3081e7..2e6ed98b 100644
--- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java
+++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java
@@ -51,7 +51,7 @@ import java.util.*;
* With the locator, every time the {@code element} is used, up-to-date DOM element is located in the page using the selector. So
* in the snippet below, underlying DOM element is going to be located twice.
*
{@code
- * Locator locator = page.locator("text=Submit");
+ * Locator locator = page.getByText("Submit");
* locator.hover();
* locator.click();
* }
@@ -1438,8 +1438,8 @@ public interface ElementHandle extends JSHandle {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
*/
default Object evalOnSelector(String selector, String expression) {
return evalOnSelector(selector, expression, null);
@@ -1464,8 +1464,8 @@ public interface ElementHandle extends JSHandle {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
* @param arg Optional argument to pass to {@code expression}.
*/
Object evalOnSelector(String selector, String expression, Object arg);
@@ -1489,8 +1489,8 @@ public interface ElementHandle extends JSHandle {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
*/
default Object evalOnSelectorAll(String selector, String expression) {
return evalOnSelectorAll(selector, expression, null);
@@ -1515,8 +1515,8 @@ public interface ElementHandle extends JSHandle {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
* @param arg Optional argument to pass to {@code expression}.
*/
Object evalOnSelectorAll(String selector, String expression, Object arg);
diff --git a/playwright/src/main/java/com/microsoft/playwright/FileChooser.java b/playwright/src/main/java/com/microsoft/playwright/FileChooser.java
index 2447b7aa..a85a4f6e 100644
--- a/playwright/src/main/java/com/microsoft/playwright/FileChooser.java
+++ b/playwright/src/main/java/com/microsoft/playwright/FileChooser.java
@@ -22,7 +22,7 @@ import java.nio.file.Path;
/**
* {@code FileChooser} objects are dispatched by the page in the {@link Page#onFileChooser Page.onFileChooser()} event.
* {@code
- * FileChooser fileChooser = page.waitForFileChooser(() -> page.locator("upload").click());
+ * FileChooser fileChooser = page.waitForFileChooser(() -> page.getByText("Upload").click());
* fileChooser.setFiles(Paths.get("myfile.pdf"));
* }
*/
diff --git a/playwright/src/main/java/com/microsoft/playwright/Frame.java b/playwright/src/main/java/com/microsoft/playwright/Frame.java
index 2336eea6..8ef8be14 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Frame.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Frame.java
@@ -794,6 +794,216 @@ public interface Frame {
return this;
}
}
+ class GetByAltTextOptions {
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public Boolean exact;
+
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public GetByAltTextOptions setExact(boolean exact) {
+ this.exact = exact;
+ return this;
+ }
+ }
+ class GetByLabelOptions {
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public Boolean exact;
+
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public GetByLabelOptions setExact(boolean exact) {
+ this.exact = exact;
+ return this;
+ }
+ }
+ class GetByPlaceholderOptions {
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public Boolean exact;
+
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public GetByPlaceholderOptions setExact(boolean exact) {
+ this.exact = exact;
+ return this;
+ }
+ }
+ class GetByRoleOptions {
+ /**
+ * An attribute that is usually set by {@code aria-checked} or native {@code } controls. Available values for
+ * checked are {@code true}, {@code false} and {@code "mixed"}.
+ *
+ * Learn more about {@code aria-checked}.
+ */
+ public Boolean checked;
+ /**
+ * A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
+ *
+ *
NOTE: Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about {@code aria-disabled}.
+ */
+ public Boolean disabled;
+ /**
+ * A boolean attribute that is usually set by {@code aria-expanded}.
+ *
+ *
Learn more about {@code aria-expanded}.
+ */
+ public Boolean expanded;
+ /**
+ * A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as defined by ARIA, are matched by role selector.
+ *
+ *
Learn more about {@code aria-hidden}.
+ */
+ public Boolean includeHidden;
+ /**
+ * A number attribute that is usually present for roles {@code heading}, {@code listitem}, {@code row}, {@code treeitem}, with default values for
+ * {@code
-} elements.
+ *
+ *
Learn more about {@code aria-level}.
+ */
+ public Integer level;
+ /**
+ * A string attribute that matches accessible name.
+ *
+ *
Learn more about accessible name.
+ */
+ 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"}.
+ *
+ *
Learn more about {@code aria-pressed}.
+ */
+ public Boolean pressed;
+ /**
+ * A boolean attribute that is usually set by {@code aria-selected}.
+ *
+ *
Learn more about {@code aria-selected}.
+ */
+ public Boolean selected;
+
+ /**
+ * An attribute that is usually set by {@code aria-checked} or native {@code } controls. Available values for
+ * checked are {@code true}, {@code false} and {@code "mixed"}.
+ *
+ *
Learn more about {@code aria-checked}.
+ */
+ public GetByRoleOptions setChecked(boolean checked) {
+ this.checked = checked;
+ return this;
+ }
+ /**
+ * A boolean attribute that is usually set by {@code aria-disabled} or {@code disabled}.
+ *
+ *
NOTE: Unlike most other attributes, {@code disabled} is inherited through the DOM hierarchy. Learn more about {@code aria-disabled}.
+ */
+ public GetByRoleOptions setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ return this;
+ }
+ /**
+ * A boolean attribute that is usually set by {@code aria-expanded}.
+ *
+ *
Learn more about {@code aria-expanded}.
+ */
+ public GetByRoleOptions setExpanded(boolean expanded) {
+ this.expanded = expanded;
+ return this;
+ }
+ /**
+ * A boolean attribute that controls whether hidden elements are matched. By default, only non-hidden elements, as defined by ARIA, are matched by role selector.
+ *
+ *
Learn more about {@code aria-hidden}.
+ */
+ public GetByRoleOptions setIncludeHidden(boolean includeHidden) {
+ this.includeHidden = includeHidden;
+ return this;
+ }
+ /**
+ * A number attribute that is usually present for roles {@code heading}, {@code listitem}, {@code row}, {@code treeitem}, with default values for
+ * {@code
-} elements.
+ *
+ *
Learn more about {@code aria-level}.
+ */
+ public GetByRoleOptions setLevel(int level) {
+ this.level = level;
+ return this;
+ }
+ /**
+ * A string attribute that matches accessible name.
+ *
+ *
Learn more about accessible name.
+ */
+ public GetByRoleOptions setName(String name) {
+ this.name = name;
+ return this;
+ }
+ /**
+ * A string attribute that matches accessible name.
+ *
+ *
Learn more about accessible name.
+ */
+ public GetByRoleOptions setName(Pattern name) {
+ this.name = name;
+ return this;
+ }
+ /**
+ * An attribute that is usually set by {@code aria-pressed}. Available values for pressed are {@code true}, {@code false} and {@code "mixed"}.
+ *
+ *
Learn more about {@code aria-pressed}.
+ */
+ public GetByRoleOptions setPressed(boolean pressed) {
+ this.pressed = pressed;
+ return this;
+ }
+ /**
+ * A boolean attribute that is usually set by {@code aria-selected}.
+ *
+ *
Learn more about {@code aria-selected}.
+ */
+ public GetByRoleOptions setSelected(boolean selected) {
+ this.selected = selected;
+ return this;
+ }
+ }
+ class GetByTextOptions {
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public Boolean exact;
+
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public GetByTextOptions setExact(boolean exact) {
+ this.exact = exact;
+ return this;
+ }
+ }
+ class GetByTitleOptions {
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public Boolean exact;
+
+ /**
+ * Whether to find an exact match: case-sensitive and whole-string. Default to false.
+ */
+ public GetByTitleOptions setExact(boolean exact) {
+ this.exact = exact;
+ return this;
+ }
+ }
class NavigateOptions {
/**
* Referer header value. If provided it will take preference over the referer header value set by {@link
@@ -2409,8 +2619,8 @@ public interface Frame {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
* @param arg Optional argument to pass to {@code expression}.
*/
default Object evalOnSelector(String selector, String expression, Object arg) {
@@ -2439,8 +2649,8 @@ public interface Frame {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
*/
default Object evalOnSelector(String selector, String expression) {
return evalOnSelector(selector, expression, null);
@@ -2468,8 +2678,8 @@ public interface Frame {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
* @param arg Optional argument to pass to {@code expression}.
*/
Object evalOnSelector(String selector, String expression, Object arg, EvalOnSelectorOptions options);
@@ -2494,8 +2704,8 @@ public interface Frame {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
*/
default Object evalOnSelectorAll(String selector, String expression) {
return evalOnSelectorAll(selector, expression, null);
@@ -2521,8 +2731,8 @@ public interface Frame {
*
* @param selector A selector to query for. See working with selectors for more
* details.
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
* @param arg Optional argument to pass to {@code expression}.
*/
Object evalOnSelectorAll(String selector, String expression, Object arg);
@@ -2555,8 +2765,8 @@ public interface Frame {
* bodyHandle.dispose();
* }
*
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
*/
default Object evaluate(String expression) {
return evaluate(expression, null);
@@ -2590,8 +2800,8 @@ public interface Frame {
* bodyHandle.dispose();
* }
*
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
* @param arg Optional argument to pass to {@code expression}.
*/
Object evaluate(String expression, Object arg);
@@ -2622,8 +2832,8 @@ public interface Frame {
* resultHandle.dispose();
* }
*
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
*/
default JSHandle evaluateHandle(String expression) {
return evaluateHandle(expression, null);
@@ -2655,8 +2865,8 @@ public interface Frame {
* resultHandle.dispose();
* }
*
- * @param expression JavaScript expression to be evaluated in the browser context. If it looks like a function declaration, it is interpreted
- * as a function. Otherwise, evaluated as an expression.
+ * @param expression JavaScript expression to be evaluated in the browser context. If the expresion evaluates to a function, the function is
+ * automatically invoked.
* @param arg Optional argument to pass to {@code expression}.
*/
JSHandle evaluateHandle(String expression, Object arg);
@@ -2733,7 +2943,7 @@ public interface Frame {
* that iframe. Following snippet locates element with text "Submit" in the iframe with id {@code my-frame}, like {@code