1
0
mirror of synced 2026-05-23 11:13:15 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Yury Semikhatsky 96cc9e6e62 chore: set version to 1.29.0 (#1178) 2023-01-18 12:06:53 -08:00
23 changed files with 423 additions and 1804 deletions
+2 -2
View File
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->110.0.5481.38<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->109.0.5414.46<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->108.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Firefox <!-- GEN:firefox-version -->107.0<!-- GEN:stop --> | :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.
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
</parent>
<artifactId>driver-bundle</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
</parent>
<artifactId>driver</artifactId>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>org.example</groupId>
<artifactId>examples</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
<name>Playwright Client Examples</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
</parent>
<artifactId>playwright</artifactId>
@@ -22,16 +22,16 @@ import java.util.*;
* {@code ConsoleMessage} objects are dispatched by page via the {@link Page#onConsoleMessage Page.onConsoleMessage()}
* event. For each console messages logged in the page there will be corresponding event in the Playwright context.
* <pre>{@code
* // Listen for all console messages and print them to the standard output.
* // Listen for all System.out.printlns
* page.onConsoleMessage(msg -> System.out.println(msg.text()));
*
* // Listen for all console messages and print errors to the standard output.
* // Listen for all console events and handle errors
* page.onConsoleMessage(msg -> {
* if ("error".equals(msg.type()))
* System.out.println("Error text: " + msg.text());
* });
*
* // Get the next console message
* // Get the next System.out.println
* ConsoleMessage msg = page.waitForConsoleMessage(() -> {
* // Issue console.log inside the page
* page.evaluate("console.log('hello', 42, { foo: 'bar' });");
@@ -3043,14 +3043,7 @@ public interface Frame {
*/
String getAttribute(String selector, String name, GetAttributeOptions options);
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3059,28 +3052,14 @@ public interface Frame {
return getByAltText(text, null);
}
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByAltText(String text, GetByAltTextOptions options);
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3089,28 +3068,15 @@ public interface Frame {
return getByAltText(text, null);
}
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByAltText(Pattern text, GetByAltTextOptions options);
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3119,28 +3085,16 @@ public interface Frame {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByLabel(String text, GetByLabelOptions options);
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3149,30 +3103,16 @@ public interface Frame {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByLabel(Pattern text, GetByLabelOptions options);
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3181,32 +3121,16 @@ public interface Frame {
return getByPlaceholder(text, null);
}
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByPlaceholder(String text, GetByPlaceholderOptions options);
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3215,16 +3139,8 @@ public interface Frame {
return getByPlaceholder(text, null);
}
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3233,39 +3149,14 @@ public interface Frame {
/**
* Allows locating elements by their <a href="https://www.w3.org/TR/wai-aria-1.2/#roles">ARIA role</a>, <a
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-attributes">ARIA attributes</a> and <a
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. Note that role selector **does not
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate each element by it's implicit role:
* <pre>{@code
* assertThat(page
* .getByRole(AriaRole.HEADING,
* new Page.GetByRoleOptions().setName("Sign up")))
* .isVisible();
*
* page.getByRole(AriaRole.CHECKBOX,
* new Page.GetByRoleOptions().setName("Subscribe"))
* .check();
*
* page.getByRole(AriaRole.BUTTON,
* new Page.GetByRoleOptions().setName(
* Pattern.compile("submit", Pattern.CASE_INSENSITIVE)))
* .click();
* }</pre>
*
* <p> **Details**
*
* <p> Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the
* ARIA guidelines.
*
* <p> Many html elements have an implicitly <a href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined
* role</a> that is recognized by the role selector. You can find all the <a
* href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>. ARIA guidelines **do not
* recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code aria-*} attributes to
* default values.
* <p> Note that many html elements have an implicitly <a
* href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined role</a> that is recognized by the role
* selector. You can find all the <a href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>.
* ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code
* aria-*} attributes to default values.
*
* @param role Required aria role.
* @since v1.27
@@ -3276,95 +3167,37 @@ public interface Frame {
/**
* Allows locating elements by their <a href="https://www.w3.org/TR/wai-aria-1.2/#roles">ARIA role</a>, <a
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-attributes">ARIA attributes</a> and <a
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. Note that role selector **does not
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate each element by it's implicit role:
* <pre>{@code
* assertThat(page
* .getByRole(AriaRole.HEADING,
* new Page.GetByRoleOptions().setName("Sign up")))
* .isVisible();
*
* page.getByRole(AriaRole.CHECKBOX,
* new Page.GetByRoleOptions().setName("Subscribe"))
* .check();
*
* page.getByRole(AriaRole.BUTTON,
* new Page.GetByRoleOptions().setName(
* Pattern.compile("submit", Pattern.CASE_INSENSITIVE)))
* .click();
* }</pre>
*
* <p> **Details**
*
* <p> Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the
* ARIA guidelines.
*
* <p> Many html elements have an implicitly <a href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined
* role</a> that is recognized by the role selector. You can find all the <a
* href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>. ARIA guidelines **do not
* recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code aria-*} attributes to
* default values.
* <p> Note that many html elements have an implicitly <a
* href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined role</a> that is recognized by the role
* selector. You can find all the <a href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>.
* ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code
* aria-*} attributes to default values.
*
* @param role Required aria role.
* @since v1.27
*/
Locator getByRole(AriaRole role, GetByRoleOptions options);
/**
* Locate element by the test id.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate the element by it's test id:
* <pre>{@code
* page.getByTestId("directions").click();
* }</pre>
*
* <p> **Details**
*
* <p> By default, the {@code data-testid} attribute is used as a test id. Use {@link Selectors#setTestIdAttribute
* Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
* Locate element by the test id. By default, the {@code data-testid} attribute is used as a test id. Use {@link
* Selectors#setTestIdAttribute Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
*
* @param testId Id to locate the element by.
* @since v1.27
*/
Locator getByTestId(String testId);
/**
* Locate element by the test id.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate the element by it's test id:
* <pre>{@code
* page.getByTestId("directions").click();
* }</pre>
*
* <p> **Details**
*
* <p> By default, the {@code data-testid} attribute is used as a test id. Use {@link Selectors#setTestIdAttribute
* Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
* Locate element by the test id. By default, the {@code data-testid} attribute is used as a test id. Use {@link
* Selectors#setTestIdAttribute Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
*
* @param testId Id to locate the element by.
* @since v1.27
*/
Locator getByTestId(Pattern testId);
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -3384,12 +3217,13 @@ public interface Frame {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -3399,14 +3233,7 @@ public interface Frame {
return getByText(text, null);
}
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -3426,12 +3253,13 @@ public interface Frame {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -3439,14 +3267,7 @@ public interface Frame {
*/
Locator getByText(String text, GetByTextOptions options);
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -3466,12 +3287,13 @@ public interface Frame {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -3481,14 +3303,7 @@ public interface Frame {
return getByText(text, null);
}
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -3508,12 +3323,13 @@ public interface Frame {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -3521,16 +3337,7 @@ public interface Frame {
*/
Locator getByText(Pattern text, GetByTextOptions options);
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3539,32 +3346,14 @@ public interface Frame {
return getByTitle(text, null);
}
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByTitle(String text, GetByTitleOptions options);
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -3573,16 +3362,7 @@ public interface Frame {
return getByTitle(text, null);
}
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -342,14 +342,7 @@ public interface FrameLocator {
*/
FrameLocator frameLocator(String selector);
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -358,28 +351,14 @@ public interface FrameLocator {
return getByAltText(text, null);
}
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByAltText(String text, GetByAltTextOptions options);
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -388,28 +367,15 @@ public interface FrameLocator {
return getByAltText(text, null);
}
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByAltText(Pattern text, GetByAltTextOptions options);
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
@@ -418,28 +384,16 @@ public interface FrameLocator {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByLabel(String text, GetByLabelOptions options);
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
@@ -448,30 +402,16 @@ public interface FrameLocator {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByLabel(Pattern text, GetByLabelOptions options);
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -480,32 +420,16 @@ public interface FrameLocator {
return getByPlaceholder(text, null);
}
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByPlaceholder(String text, GetByPlaceholderOptions options);
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -514,16 +438,8 @@ public interface FrameLocator {
return getByPlaceholder(text, null);
}
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -532,39 +448,14 @@ public interface FrameLocator {
/**
* Allows locating elements by their <a href="https://www.w3.org/TR/wai-aria-1.2/#roles">ARIA role</a>, <a
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-attributes">ARIA attributes</a> and <a
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. Note that role selector **does not
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate each element by it's implicit role:
* <pre>{@code
* assertThat(page
* .getByRole(AriaRole.HEADING,
* new Page.GetByRoleOptions().setName("Sign up")))
* .isVisible();
*
* page.getByRole(AriaRole.CHECKBOX,
* new Page.GetByRoleOptions().setName("Subscribe"))
* .check();
*
* page.getByRole(AriaRole.BUTTON,
* new Page.GetByRoleOptions().setName(
* Pattern.compile("submit", Pattern.CASE_INSENSITIVE)))
* .click();
* }</pre>
*
* <p> **Details**
*
* <p> Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the
* ARIA guidelines.
*
* <p> Many html elements have an implicitly <a href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined
* role</a> that is recognized by the role selector. You can find all the <a
* href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>. ARIA guidelines **do not
* recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code aria-*} attributes to
* default values.
* <p> Note that many html elements have an implicitly <a
* href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined role</a> that is recognized by the role
* selector. You can find all the <a href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>.
* ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code
* aria-*} attributes to default values.
*
* @param role Required aria role.
* @since v1.27
@@ -575,95 +466,37 @@ public interface FrameLocator {
/**
* Allows locating elements by their <a href="https://www.w3.org/TR/wai-aria-1.2/#roles">ARIA role</a>, <a
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-attributes">ARIA attributes</a> and <a
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. Note that role selector **does not
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate each element by it's implicit role:
* <pre>{@code
* assertThat(page
* .getByRole(AriaRole.HEADING,
* new Page.GetByRoleOptions().setName("Sign up")))
* .isVisible();
*
* page.getByRole(AriaRole.CHECKBOX,
* new Page.GetByRoleOptions().setName("Subscribe"))
* .check();
*
* page.getByRole(AriaRole.BUTTON,
* new Page.GetByRoleOptions().setName(
* Pattern.compile("submit", Pattern.CASE_INSENSITIVE)))
* .click();
* }</pre>
*
* <p> **Details**
*
* <p> Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the
* ARIA guidelines.
*
* <p> Many html elements have an implicitly <a href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined
* role</a> that is recognized by the role selector. You can find all the <a
* href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>. ARIA guidelines **do not
* recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code aria-*} attributes to
* default values.
* <p> Note that many html elements have an implicitly <a
* href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined role</a> that is recognized by the role
* selector. You can find all the <a href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>.
* ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code
* aria-*} attributes to default values.
*
* @param role Required aria role.
* @since v1.27
*/
Locator getByRole(AriaRole role, GetByRoleOptions options);
/**
* Locate element by the test id.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate the element by it's test id:
* <pre>{@code
* page.getByTestId("directions").click();
* }</pre>
*
* <p> **Details**
*
* <p> By default, the {@code data-testid} attribute is used as a test id. Use {@link Selectors#setTestIdAttribute
* Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
* Locate element by the test id. By default, the {@code data-testid} attribute is used as a test id. Use {@link
* Selectors#setTestIdAttribute Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
*
* @param testId Id to locate the element by.
* @since v1.27
*/
Locator getByTestId(String testId);
/**
* Locate element by the test id.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate the element by it's test id:
* <pre>{@code
* page.getByTestId("directions").click();
* }</pre>
*
* <p> **Details**
*
* <p> By default, the {@code data-testid} attribute is used as a test id. Use {@link Selectors#setTestIdAttribute
* Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
* Locate element by the test id. By default, the {@code data-testid} attribute is used as a test id. Use {@link
* Selectors#setTestIdAttribute Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
*
* @param testId Id to locate the element by.
* @since v1.27
*/
Locator getByTestId(Pattern testId);
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -683,12 +516,13 @@ public interface FrameLocator {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -698,14 +532,7 @@ public interface FrameLocator {
return getByText(text, null);
}
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -725,12 +552,13 @@ public interface FrameLocator {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -738,14 +566,7 @@ public interface FrameLocator {
*/
Locator getByText(String text, GetByTextOptions options);
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -765,12 +586,13 @@ public interface FrameLocator {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -780,14 +602,7 @@ public interface FrameLocator {
return getByText(text, null);
}
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -807,12 +622,13 @@ public interface FrameLocator {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -820,16 +636,7 @@ public interface FrameLocator {
*/
Locator getByText(Pattern text, GetByTextOptions options);
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -838,32 +645,14 @@ public interface FrameLocator {
return getByTitle(text, null);
}
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByTitle(String text, GetByTitleOptions options);
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -872,16 +661,7 @@ public interface FrameLocator {
return getByTitle(text, null);
}
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
File diff suppressed because it is too large Load Diff
@@ -4550,14 +4550,7 @@ public interface Page extends AutoCloseable {
*/
String getAttribute(String selector, String name, GetAttributeOptions options);
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -4566,28 +4559,14 @@ public interface Page extends AutoCloseable {
return getByAltText(text, null);
}
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByAltText(String text, GetByAltTextOptions options);
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -4596,28 +4575,15 @@ public interface Page extends AutoCloseable {
return getByAltText(text, null);
}
/**
* Allows locating elements by their alt text.
*
* <p> **Usage**
*
* <p> For example, this method will find the image by alt text "Playwright logo":
* <pre>{@code
* page.getByAltText("Playwright logo").click();
* }</pre>
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByAltText(Pattern text, GetByAltTextOptions options);
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
@@ -4626,28 +4592,16 @@ public interface Page extends AutoCloseable {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByLabel(String text, GetByLabelOptions options);
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
@@ -4656,30 +4610,16 @@ public interface Page extends AutoCloseable {
return getByLabel(text, null);
}
/**
* Allows locating input elements by the text of the associated label.
*
* <p> **Usage**
*
* <p> For example, this method will find the input by label text "Password" in the following DOM:
* <pre>{@code
* page.getByLabel("Password").fill("secret");
* }</pre>
* Allows locating input elements by the text of the associated label. For example, this method will find the input by
* label text "Password" in the following DOM:
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByLabel(Pattern text, GetByLabelOptions options);
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -4688,32 +4628,16 @@ public interface Page extends AutoCloseable {
return getByPlaceholder(text, null);
}
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByPlaceholder(String text, GetByPlaceholderOptions options);
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -4722,16 +4646,8 @@ public interface Page extends AutoCloseable {
return getByPlaceholder(text, null);
}
/**
* Allows locating input elements by the placeholder text.
*
* <p> **Usage**
*
* <p> For example, consider the following DOM structure.
*
* <p> You can fill the input after locating it by the placeholder text:
* <pre>{@code
* page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
* }</pre>
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
* "Country":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -4740,39 +4656,14 @@ public interface Page extends AutoCloseable {
/**
* Allows locating elements by their <a href="https://www.w3.org/TR/wai-aria-1.2/#roles">ARIA role</a>, <a
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-attributes">ARIA attributes</a> and <a
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. Note that role selector **does not
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate each element by it's implicit role:
* <pre>{@code
* assertThat(page
* .getByRole(AriaRole.HEADING,
* new Page.GetByRoleOptions().setName("Sign up")))
* .isVisible();
*
* page.getByRole(AriaRole.CHECKBOX,
* new Page.GetByRoleOptions().setName("Subscribe"))
* .check();
*
* page.getByRole(AriaRole.BUTTON,
* new Page.GetByRoleOptions().setName(
* Pattern.compile("submit", Pattern.CASE_INSENSITIVE)))
* .click();
* }</pre>
*
* <p> **Details**
*
* <p> Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the
* ARIA guidelines.
*
* <p> Many html elements have an implicitly <a href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined
* role</a> that is recognized by the role selector. You can find all the <a
* href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>. ARIA guidelines **do not
* recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code aria-*} attributes to
* default values.
* <p> Note that many html elements have an implicitly <a
* href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined role</a> that is recognized by the role
* selector. You can find all the <a href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>.
* ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code
* aria-*} attributes to default values.
*
* @param role Required aria role.
* @since v1.27
@@ -4783,95 +4674,37 @@ public interface Page extends AutoCloseable {
/**
* Allows locating elements by their <a href="https://www.w3.org/TR/wai-aria-1.2/#roles">ARIA role</a>, <a
* href="https://www.w3.org/TR/wai-aria-1.2/#aria-attributes">ARIA attributes</a> and <a
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>. Note that role selector **does not
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate each element by it's implicit role:
* <pre>{@code
* assertThat(page
* .getByRole(AriaRole.HEADING,
* new Page.GetByRoleOptions().setName("Sign up")))
* .isVisible();
*
* page.getByRole(AriaRole.CHECKBOX,
* new Page.GetByRoleOptions().setName("Subscribe"))
* .check();
*
* page.getByRole(AriaRole.BUTTON,
* new Page.GetByRoleOptions().setName(
* Pattern.compile("submit", Pattern.CASE_INSENSITIVE)))
* .click();
* }</pre>
*
* <p> **Details**
*
* <p> Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the
* ARIA guidelines.
*
* <p> Many html elements have an implicitly <a href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined
* role</a> that is recognized by the role selector. You can find all the <a
* href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>. ARIA guidelines **do not
* recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code aria-*} attributes to
* default values.
* <p> Note that many html elements have an implicitly <a
* href="https://w3c.github.io/html-aam/#html-element-role-mappings">defined role</a> that is recognized by the role
* selector. You can find all the <a href="https://www.w3.org/TR/wai-aria-1.2/#role_definitions">supported roles here</a>.
* ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting {@code role} and/or {@code
* aria-*} attributes to default values.
*
* @param role Required aria role.
* @since v1.27
*/
Locator getByRole(AriaRole role, GetByRoleOptions options);
/**
* Locate element by the test id.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate the element by it's test id:
* <pre>{@code
* page.getByTestId("directions").click();
* }</pre>
*
* <p> **Details**
*
* <p> By default, the {@code data-testid} attribute is used as a test id. Use {@link Selectors#setTestIdAttribute
* Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
* Locate element by the test id. By default, the {@code data-testid} attribute is used as a test id. Use {@link
* Selectors#setTestIdAttribute Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
*
* @param testId Id to locate the element by.
* @since v1.27
*/
Locator getByTestId(String testId);
/**
* Locate element by the test id.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can locate the element by it's test id:
* <pre>{@code
* page.getByTestId("directions").click();
* }</pre>
*
* <p> **Details**
*
* <p> By default, the {@code data-testid} attribute is used as a test id. Use {@link Selectors#setTestIdAttribute
* Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
* Locate element by the test id. By default, the {@code data-testid} attribute is used as a test id. Use {@link
* Selectors#setTestIdAttribute Selectors.setTestIdAttribute()} to configure a different test id attribute if necessary.
*
* @param testId Id to locate the element by.
* @since v1.27
*/
Locator getByTestId(Pattern testId);
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -4891,12 +4724,13 @@ public interface Page extends AutoCloseable {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -4906,14 +4740,7 @@ public interface Page extends AutoCloseable {
return getByText(text, null);
}
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -4933,12 +4760,13 @@ public interface Page extends AutoCloseable {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -4946,14 +4774,7 @@ public interface Page extends AutoCloseable {
*/
Locator getByText(String text, GetByTextOptions options);
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -4973,12 +4794,13 @@ public interface Page extends AutoCloseable {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -4988,14 +4810,7 @@ public interface Page extends AutoCloseable {
return getByText(text, null);
}
/**
* Allows locating elements that contain given text.
*
* <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> **Usage**
*
* <p> Consider the following DOM structure:
* 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
@@ -5015,12 +4830,13 @@ public interface Page extends AutoCloseable {
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
* }</pre>
*
* <p> **Details**
* <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> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
* <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> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
* <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.
@@ -5028,16 +4844,7 @@ public interface Page extends AutoCloseable {
*/
Locator getByText(Pattern text, GetByTextOptions options);
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -5046,32 +4853,14 @@ public interface Page extends AutoCloseable {
return getByTitle(text, null);
}
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
*/
Locator getByTitle(String text, GetByTitleOptions options);
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -5080,16 +4869,7 @@ public interface Page extends AutoCloseable {
return getByTitle(text, null);
}
/**
* Allows locating elements by their title attribute.
*
* <p> **Usage**
*
* <p> Consider the following DOM structure.
*
* <p> You can check the issues count after locating it by the title text:
* <pre>{@code
* assertThat(page.getByTitle("Issues count")).hasText("25 issues");
* }</pre>
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
*
* @param text Text to locate the element for.
* @since v1.27
@@ -7218,7 +6998,25 @@ public interface Page extends AutoCloseable {
*/
void waitForLoadState(LoadState state, WaitForLoadStateOptions options);
/**
* @deprecated This method is inherently racy, please use {@link Page#waitForURL Page.waitForURL()} instead.
* Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the
* navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or
* navigation due to History API usage, the navigation will resolve with {@code null}.
*
* <p> **Usage**
*
* <p> This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly
* cause the page to navigate. e.g. The click target has an {@code onclick} handler that triggers navigation from a {@code
* setTimeout}. Consider this example:
* <pre>{@code
* // The method returns after navigation has finished
* Response response = page.waitForNavigation(() -> {
* // This action triggers the navigation after a timeout.
* page.getByText("Navigate after timeout").click();
* });
* }</pre>
*
* <p> <strong>NOTE:</strong> Usage of the <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API">History API</a> to change the URL is
* considered a navigation.
*
* @param callback Callback that performs the action triggering the event.
* @since v1.8
@@ -7227,7 +7025,25 @@ public interface Page extends AutoCloseable {
return waitForNavigation(null, callback);
}
/**
* @deprecated This method is inherently racy, please use {@link Page#waitForURL Page.waitForURL()} instead.
* Waits for the main frame navigation and returns the main resource response. In case of multiple redirects, the
* navigation will resolve with the response of the last redirect. In case of navigation to a different anchor or
* navigation due to History API usage, the navigation will resolve with {@code null}.
*
* <p> **Usage**
*
* <p> This resolves when the page navigates to a new URL or reloads. It is useful for when you run code which will indirectly
* cause the page to navigate. e.g. The click target has an {@code onclick} handler that triggers navigation from a {@code
* setTimeout}. Consider this example:
* <pre>{@code
* // The method returns after navigation has finished
* Response response = page.waitForNavigation(() -> {
* // This action triggers the navigation after a timeout.
* page.getByText("Navigate after timeout").click();
* });
* }</pre>
*
* <p> <strong>NOTE:</strong> Usage of the <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API">History API</a> to change the URL is
* considered a navigation.
*
* @param callback Callback that performs the action triggering the event.
* @since v1.8
@@ -547,8 +547,8 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
}
}
WaitableResult<JsonElement> pause() {
return sendMessageAsync("pause", new JsonObject());
void pause() {
sendMessage("pause");
}
@Override
@@ -17,7 +17,6 @@
package com.microsoft.playwright.impl;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.microsoft.playwright.*;
import com.microsoft.playwright.options.*;
@@ -950,7 +949,7 @@ public class PageImpl extends ChannelOwner implements Page {
@Override
public void pause() {
withLogging("BrowserContext.pause", () -> {
new WaitableRace<>(asList(context().pause(), (Waitable<JsonElement>) waitableClosedOrCrashed)).get();
context().pause();
});
}
@@ -164,10 +164,10 @@ public class TestGlobalFetch extends TestBase {
@Test
void shouldSupportGlobalTimeoutOption() {
APIRequestContext request = playwright.request().newContext(new APIRequest.NewContextOptions().setTimeout(100));
APIRequestContext request = playwright.request().newContext(new APIRequest.NewContextOptions().setTimeout(1));
server.setRoute("/empty.html", exchange -> {});
PlaywrightException e = assertThrows(PlaywrightException.class, () -> request.get(server.EMPTY_PAGE));
assertTrue(e.getMessage().contains("Request timed out after 100ms"), e.getMessage());
assertTrue(e.getMessage().contains("Request timed out after 1ms"), e.getMessage());
}
@@ -193,7 +193,7 @@ public class TestLocatorAssertions extends TestBase {
assertThat(locator).not().hasText(new String[] {}, new LocatorAssertions.HasTextOptions().setTimeout(1000));
});
assertEquals("[]", e.getExpected().getStringRepresentation());
assertEquals("[]", e.getActual().getStringRepresentation());
assertEquals("null", e.getActual().getStringRepresentation());
assertTrue(e.getMessage().contains("Locator expected not to have text"), e.getMessage());
}
@@ -44,7 +44,7 @@ public class TestPageFill extends TestBase {
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.fill("input", ""));
assertTrue(e.getMessage().contains("Error: Input of type \"" + type + "\" cannot be filled"), "type = " + type + e.getMessage());
assertTrue(e.getMessage().contains("input of type \"" + type + "\" cannot be filled"), "type = " + type + e.getMessage());
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>parent-pom</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
<packaging>pom</packaging>
<name>Playwright Parent Project</name>
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
+1 -1
View File
@@ -1 +1 @@
1.30.0-beta-1674276599000
1.29.2
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>api-generator</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
<name>Playwright - API Generator</name>
<description>
This is an internal module used to generate Java API from the upstream Playwright
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-cli-fatjar</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
<name>Test Playwright Command Line FatJar</name>
<properties>
<compiler.version>1.8</compiler.version>
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-cli-version</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
<name>Test Playwright Command Line Version</name>
<properties>
<compiler.version>1.8</compiler.version>
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-local-installation</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
<name>Test local installation</name>
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
<properties>
+1 -1
View File
@@ -9,7 +9,7 @@
</parent>
<groupId>com.microsoft.playwright</groupId>
<artifactId>test-spring-boot-starter</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
<name>Test Playwright With Spring Boot</name>
<properties>
<spring.version>2.4.3</spring.version>
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>com.microsoft.playwright</groupId>
<artifactId>update-version</artifactId>
<version>1.30.0</version>
<version>1.29.0</version>
<name>Playwright - Update Version in Documentation</name>
<description>
This is an internal module used to update versions in the documentation based on