Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 37c16dd06b | |||
| 96b432d528 | |||
| 551c168884 | |||
| 9010fa95a0 |
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
|
||||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->109.0.5414.46<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->110.0.5481.38<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Firefox <!-- GEN:firefox-version -->107.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->108.0.2<!-- 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.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>parent-pom</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>driver-bundle</artifactId>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>parent-pom</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>driver</artifactId>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>examples</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
<name>Playwright Client Examples</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>parent-pom</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.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 System.out.printlns
|
||||
* // Listen for all console messages and print them to the standard output.
|
||||
* page.onConsoleMessage(msg -> System.out.println(msg.text()));
|
||||
*
|
||||
* // Listen for all console events and handle errors
|
||||
* // Listen for all console messages and print errors to the standard output.
|
||||
* page.onConsoleMessage(msg -> {
|
||||
* if ("error".equals(msg.type()))
|
||||
* System.out.println("Error text: " + msg.text());
|
||||
* });
|
||||
*
|
||||
* // Get the next System.out.println
|
||||
* // Get the next console message
|
||||
* ConsoleMessage msg = page.waitForConsoleMessage(() -> {
|
||||
* // Issue console.log inside the page
|
||||
* page.evaluate("console.log('hello', 42, { foo: 'bar' });");
|
||||
|
||||
@@ -3043,7 +3043,14 @@ public interface Frame {
|
||||
*/
|
||||
String getAttribute(String selector, String name, GetAttributeOptions options);
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3052,14 +3059,28 @@ public interface Frame {
|
||||
return getByAltText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByAltText(String text, GetByAltTextOptions options);
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3068,15 +3089,28 @@ public interface Frame {
|
||||
return getByAltText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by
|
||||
* label text "Password" in the following DOM:
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3085,16 +3119,28 @@ public interface Frame {
|
||||
return getByLabel(text, null);
|
||||
}
|
||||
/**
|
||||
* 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:
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by
|
||||
* label text "Password" in the following DOM:
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3103,16 +3149,30 @@ public interface Frame {
|
||||
return getByLabel(text, null);
|
||||
}
|
||||
/**
|
||||
* 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:
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3121,16 +3181,32 @@ public interface Frame {
|
||||
return getByPlaceholder(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3139,8 +3215,16 @@ public interface Frame {
|
||||
return getByPlaceholder(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3149,14 +3233,39 @@ 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>. Note that role selector **does not
|
||||
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
|
||||
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*
|
||||
* <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.
|
||||
* <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.
|
||||
*
|
||||
* @param role Required aria role.
|
||||
* @since v1.27
|
||||
@@ -3167,37 +3276,95 @@ 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>. Note that role selector **does not
|
||||
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
|
||||
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*
|
||||
* <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.
|
||||
* <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.
|
||||
*
|
||||
* @param role Required aria role.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByRole(AriaRole role, GetByRoleOptions options);
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @param testId Id to locate the element by.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTestId(String testId);
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @param testId Id to locate the element by.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTestId(Pattern testId);
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -3217,13 +3384,12 @@ public interface Frame {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -3233,7 +3399,14 @@ public interface Frame {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -3253,13 +3426,12 @@ public interface Frame {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -3267,7 +3439,14 @@ public interface Frame {
|
||||
*/
|
||||
Locator getByText(String text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -3287,13 +3466,12 @@ public interface Frame {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -3303,7 +3481,14 @@ public interface Frame {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -3323,13 +3508,12 @@ public interface Frame {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -3337,7 +3521,16 @@ public interface Frame {
|
||||
*/
|
||||
Locator getByText(Pattern text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3346,14 +3539,32 @@ public interface Frame {
|
||||
return getByTitle(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTitle(String text, GetByTitleOptions options);
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -3362,7 +3573,16 @@ public interface Frame {
|
||||
return getByTitle(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
|
||||
@@ -342,7 +342,14 @@ public interface FrameLocator {
|
||||
*/
|
||||
FrameLocator frameLocator(String selector);
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -351,14 +358,28 @@ public interface FrameLocator {
|
||||
return getByAltText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByAltText(String text, GetByAltTextOptions options);
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -367,15 +388,28 @@ public interface FrameLocator {
|
||||
return getByAltText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by
|
||||
* label text "Password" in the following DOM:
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -384,16 +418,28 @@ public interface FrameLocator {
|
||||
return getByLabel(text, null);
|
||||
}
|
||||
/**
|
||||
* 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:
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by
|
||||
* label text "Password" in the following DOM:
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -402,16 +448,30 @@ public interface FrameLocator {
|
||||
return getByLabel(text, null);
|
||||
}
|
||||
/**
|
||||
* 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:
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -420,16 +480,32 @@ public interface FrameLocator {
|
||||
return getByPlaceholder(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -438,8 +514,16 @@ public interface FrameLocator {
|
||||
return getByPlaceholder(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -448,14 +532,39 @@ 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>. Note that role selector **does not
|
||||
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
|
||||
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*
|
||||
* <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.
|
||||
* <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.
|
||||
*
|
||||
* @param role Required aria role.
|
||||
* @since v1.27
|
||||
@@ -466,37 +575,95 @@ 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>. Note that role selector **does not
|
||||
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
|
||||
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*
|
||||
* <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.
|
||||
* <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.
|
||||
*
|
||||
* @param role Required aria role.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByRole(AriaRole role, GetByRoleOptions options);
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @param testId Id to locate the element by.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTestId(String testId);
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @param testId Id to locate the element by.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTestId(Pattern testId);
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -516,13 +683,12 @@ public interface FrameLocator {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -532,7 +698,14 @@ public interface FrameLocator {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -552,13 +725,12 @@ public interface FrameLocator {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -566,7 +738,14 @@ public interface FrameLocator {
|
||||
*/
|
||||
Locator getByText(String text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -586,13 +765,12 @@ public interface FrameLocator {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -602,7 +780,14 @@ public interface FrameLocator {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -622,13 +807,12 @@ public interface FrameLocator {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -636,7 +820,16 @@ public interface FrameLocator {
|
||||
*/
|
||||
Locator getByText(Pattern text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -645,14 +838,32 @@ public interface FrameLocator {
|
||||
return getByTitle(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTitle(String text, GetByTitleOptions options);
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -661,7 +872,16 @@ public interface FrameLocator {
|
||||
return getByTitle(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4550,7 +4550,14 @@ public interface Page extends AutoCloseable {
|
||||
*/
|
||||
String getAttribute(String selector, String name, GetAttributeOptions options);
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4559,14 +4566,28 @@ public interface Page extends AutoCloseable {
|
||||
return getByAltText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByAltText(String text, GetByAltTextOptions options);
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4575,15 +4596,28 @@ public interface Page extends AutoCloseable {
|
||||
return getByAltText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their alt text. For example, this method will find the image by alt text "Castle":
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by
|
||||
* label text "Password" in the following DOM:
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4592,16 +4626,28 @@ public interface Page extends AutoCloseable {
|
||||
return getByLabel(text, null);
|
||||
}
|
||||
/**
|
||||
* 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:
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by
|
||||
* label text "Password" in the following DOM:
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4610,16 +4656,30 @@ public interface Page extends AutoCloseable {
|
||||
return getByLabel(text, null);
|
||||
}
|
||||
/**
|
||||
* 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:
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4628,16 +4688,32 @@ public interface Page extends AutoCloseable {
|
||||
return getByPlaceholder(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @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. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4646,8 +4722,16 @@ public interface Page extends AutoCloseable {
|
||||
return getByPlaceholder(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating input elements by the placeholder text. For example, this method will find the input by placeholder
|
||||
* "Country":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4656,14 +4740,39 @@ 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>. Note that role selector **does not
|
||||
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
|
||||
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*
|
||||
* <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.
|
||||
* <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.
|
||||
*
|
||||
* @param role Required aria role.
|
||||
* @since v1.27
|
||||
@@ -4674,37 +4783,95 @@ 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>. Note that role selector **does not
|
||||
* replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.
|
||||
* href="https://w3c.github.io/accname/#dfn-accessible-name">accessible name</a>.
|
||||
*
|
||||
* <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.
|
||||
* <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.
|
||||
*
|
||||
* @param role Required aria role.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByRole(AriaRole role, GetByRoleOptions options);
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @param testId Id to locate the element by.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTestId(String testId);
|
||||
/**
|
||||
* 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.
|
||||
* 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.
|
||||
*
|
||||
* @param testId Id to locate the element by.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTestId(Pattern testId);
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -4724,13 +4891,12 @@ public interface Page extends AutoCloseable {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -4740,7 +4906,14 @@ public interface Page extends AutoCloseable {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -4760,13 +4933,12 @@ public interface Page extends AutoCloseable {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -4774,7 +4946,14 @@ public interface Page extends AutoCloseable {
|
||||
*/
|
||||
Locator getByText(String text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -4794,13 +4973,12 @@ public interface Page extends AutoCloseable {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -4810,7 +4988,14 @@ public interface Page extends AutoCloseable {
|
||||
return getByText(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements that contain given text. Consider the following DOM structure:
|
||||
* 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:
|
||||
*
|
||||
* <p> You can locate by text substring, exact string, or a regular expression:
|
||||
* <pre>{@code
|
||||
@@ -4830,13 +5015,12 @@ public interface Page extends AutoCloseable {
|
||||
* page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
|
||||
* }</pre>
|
||||
*
|
||||
* <p> See also {@link Locator#filter Locator.filter()} that allows to match by another criteria, like an accessible role, and
|
||||
* then filter by the text content.
|
||||
* <p> **Details**
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* <p> Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one,
|
||||
* turns line breaks into spaces and ignores leading and trailing whitespace.
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Input elements of the type {@code button} and {@code submit} are matched by their {@code value} instead of the text
|
||||
* <p> 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.
|
||||
@@ -4844,7 +5028,16 @@ public interface Page extends AutoCloseable {
|
||||
*/
|
||||
Locator getByText(Pattern text, GetByTextOptions options);
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4853,14 +5046,32 @@ public interface Page extends AutoCloseable {
|
||||
return getByTitle(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
*/
|
||||
Locator getByTitle(String text, GetByTitleOptions options);
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -4869,7 +5080,16 @@ public interface Page extends AutoCloseable {
|
||||
return getByTitle(text, null);
|
||||
}
|
||||
/**
|
||||
* Allows locating elements by their title. For example, this method will find the button by its title "Place the order":
|
||||
* 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>
|
||||
*
|
||||
* @param text Text to locate the element for.
|
||||
* @since v1.27
|
||||
@@ -6998,25 +7218,7 @@ public interface Page extends AutoCloseable {
|
||||
*/
|
||||
void waitForLoadState(LoadState state, WaitForLoadStateOptions options);
|
||||
/**
|
||||
* 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.
|
||||
* @deprecated This method is inherently racy, please use {@link Page#waitForURL Page.waitForURL()} instead.
|
||||
*
|
||||
* @param callback Callback that performs the action triggering the event.
|
||||
* @since v1.8
|
||||
@@ -7025,25 +7227,7 @@ public interface Page extends AutoCloseable {
|
||||
return waitForNavigation(null, callback);
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
* @deprecated This method is inherently racy, please use {@link Page#waitForURL Page.waitForURL()} instead.
|
||||
*
|
||||
* @param callback Callback that performs the action triggering the event.
|
||||
* @since v1.8
|
||||
|
||||
@@ -547,8 +547,8 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
||||
}
|
||||
}
|
||||
|
||||
void pause() {
|
||||
sendMessage("pause");
|
||||
WaitableResult<JsonElement> pause() {
|
||||
return sendMessageAsync("pause", new JsonObject());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
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.*;
|
||||
@@ -949,7 +950,7 @@ public class PageImpl extends ChannelOwner implements Page {
|
||||
@Override
|
||||
public void pause() {
|
||||
withLogging("BrowserContext.pause", () -> {
|
||||
context().pause();
|
||||
new WaitableRace<>(asList(context().pause(), (Waitable<JsonElement>) waitableClosedOrCrashed)).get();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -164,10 +164,10 @@ public class TestGlobalFetch extends TestBase {
|
||||
|
||||
@Test
|
||||
void shouldSupportGlobalTimeoutOption() {
|
||||
APIRequestContext request = playwright.request().newContext(new APIRequest.NewContextOptions().setTimeout(1));
|
||||
APIRequestContext request = playwright.request().newContext(new APIRequest.NewContextOptions().setTimeout(100));
|
||||
server.setRoute("/empty.html", exchange -> {});
|
||||
PlaywrightException e = assertThrows(PlaywrightException.class, () -> request.get(server.EMPTY_PAGE));
|
||||
assertTrue(e.getMessage().contains("Request timed out after 1ms"), e.getMessage());
|
||||
assertTrue(e.getMessage().contains("Request timed out after 100ms"), 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("null", e.getActual().getStringRepresentation());
|
||||
assertEquals("[]", 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("input of type \"" + type + "\" cannot be filled"), "type = " + type + e.getMessage());
|
||||
assertTrue(e.getMessage().contains("Error: Input of type \"" + type + "\" cannot be filled"), "type = " + type + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>parent-pom</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.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
@@ -1 +1 @@
|
||||
1.29.2
|
||||
1.30.0-beta-1674276599000
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>api-generator</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
<name>Playwright - API Generator</name>
|
||||
<description>
|
||||
This is an internal module used to generate Java API from the upstream Playwright
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>test-cli-fatjar</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
<name>Test Playwright Command Line FatJar</name>
|
||||
<properties>
|
||||
<compiler.version>1.8</compiler.version>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>test-cli-version</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
<name>Test Playwright Command Line Version</name>
|
||||
<properties>
|
||||
<compiler.version>1.8</compiler.version>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>test-local-installation</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
<name>Test local installation</name>
|
||||
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
|
||||
<properties>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</parent>
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>test-spring-boot-starter</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
<name>Test Playwright With Spring Boot</name>
|
||||
<properties>
|
||||
<spring.version>2.4.3</spring.version>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.microsoft.playwright</groupId>
|
||||
<artifactId>update-version</artifactId>
|
||||
<version>1.29.0-SNAPSHOT</version>
|
||||
<version>1.30.0</version>
|
||||
<name>Playwright - Update Version in Documentation</name>
|
||||
<description>
|
||||
This is an internal module used to update versions in the documentation based on
|
||||
|
||||
Reference in New Issue
Block a user