Skip to content

Commit ef7f50c

Browse files
authored
feat: roll driver, implement locator filters (#921)
1 parent 473b1ce commit ef7f50c

File tree

13 files changed

+1139
-173
lines changed

13 files changed

+1139
-173
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
1111

1212
| | Linux | macOS | Windows |
1313
| :--- | :---: | :---: | :---: |
14-
| Chromium <!-- GEN:chromium-version -->101.0.4951.15<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
14+
| Chromium <!-- GEN:chromium-version -->102.0.5005.40<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1515
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> ||||
16-
| Firefox <!-- GEN:firefox-version -->98.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
16+
| Firefox <!-- GEN:firefox-version -->99.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1717

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

playwright/src/main/java/com/microsoft/playwright/ElementHandle.java

Lines changed: 84 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,13 +1601,21 @@ default void hover() {
16011601
*/
16021602
String innerText();
16031603
/**
1604-
* Returns {@code input.value} for {@code <input>} or {@code <textarea>} or {@code <select>} element. Throws for non-input elements.
1604+
* Returns {@code input.value} for the selected {@code <input>} or {@code <textarea>} or {@code <select>} element.
1605+
*
1606+
* <p> Throws for non-input elements. However, if the element is inside the {@code <label>} element that has an associated <a
1607+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, returns the value of the
1608+
* control.
16051609
*/
16061610
default String inputValue() {
16071611
return inputValue(null);
16081612
}
16091613
/**
1610-
* Returns {@code input.value} for {@code <input>} or {@code <textarea>} or {@code <select>} element. Throws for non-input elements.
1614+
* Returns {@code input.value} for the selected {@code <input>} or {@code <textarea>} or {@code <select>} element.
1615+
*
1616+
* <p> Throws for non-input elements. However, if the element is inside the {@code <label>} element that has an associated <a
1617+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, returns the value of the
1618+
* control.
16111619
*/
16121620
String inputValue(InputValueOptions options);
16131621
/**
@@ -1709,19 +1717,27 @@ default void press(String key) {
17091717
*/
17101718
List<ElementHandle> querySelectorAll(String selector);
17111719
/**
1712-
* Returns the buffer with the captured screenshot.
1720+
* This method captures a screenshot of the page, clipped to the size and position of this particular element. If the
1721+
* element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable
1722+
* container, only the currently scrolled content will be visible on the screenshot.
17131723
*
17141724
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
17151725
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
1726+
*
1727+
* <p> Returns the buffer with the captured screenshot.
17161728
*/
17171729
default byte[] screenshot() {
17181730
return screenshot(null);
17191731
}
17201732
/**
1721-
* Returns the buffer with the captured screenshot.
1733+
* This method captures a screenshot of the page, clipped to the size and position of this particular element. If the
1734+
* element is covered by other elements, it will not be actually visible on the screenshot. If the element is a scrollable
1735+
* container, only the currently scrolled content will be visible on the screenshot.
17221736
*
17231737
* <p> This method waits for the <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then
17241738
* scrolls element into view before taking a screenshot. If the element is detached from DOM, the method throws an error.
1739+
*
1740+
* <p> Returns the buffer with the captured screenshot.
17251741
*/
17261742
byte[] screenshot(ScreenshotOptions options);
17271743
/**
@@ -2071,13 +2087,21 @@ default List<String> selectOption(SelectOption[] values) {
20712087
/**
20722088
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
20732089
* the element and selects all its text content.
2090+
*
2091+
* <p> If the element is inside the {@code <label>} element that has an associated <a
2092+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, focuses and selects text
2093+
* in the control instead.
20742094
*/
20752095
default void selectText() {
20762096
selectText(null);
20772097
}
20782098
/**
20792099
* This method waits for <a href="https://playwright.dev/java/docs/actionability">actionability</a> checks, then focuses
20802100
* the element and selects all its text content.
2101+
*
2102+
* <p> If the element is inside the {@code <label>} element that has an associated <a
2103+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, focuses and selects text
2104+
* in the control instead.
20812105
*/
20822106
void selectText(SelectTextOptions options);
20832107
/**
@@ -2121,75 +2145,99 @@ default void setChecked(boolean checked) {
21212145
*/
21222146
void setChecked(boolean checked, SetCheckedOptions options);
21232147
/**
2124-
* This method expects {@code elementHandle} to point to an <a
2125-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>.
2148+
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2149+
* are resolved relative to the current working directory. For empty array, clears the selected files.
21262150
*
2127-
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2128-
* are resolved relative to the the current working directory. For empty array, clears the selected files.
2151+
* <p> This method expects {@code ElementHandle} to point to an <a
2152+
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
2153+
* inside the {@code <label>} element that has an associated <a
2154+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, targets the control
2155+
* instead.
21292156
*/
21302157
default void setInputFiles(Path files) {
21312158
setInputFiles(files, null);
21322159
}
21332160
/**
2134-
* This method expects {@code elementHandle} to point to an <a
2135-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>.
2161+
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2162+
* are resolved relative to the current working directory. For empty array, clears the selected files.
21362163
*
2137-
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2138-
* are resolved relative to the the current working directory. For empty array, clears the selected files.
2164+
* <p> This method expects {@code ElementHandle} to point to an <a
2165+
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
2166+
* inside the {@code <label>} element that has an associated <a
2167+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, targets the control
2168+
* instead.
21392169
*/
21402170
void setInputFiles(Path files, SetInputFilesOptions options);
21412171
/**
2142-
* This method expects {@code elementHandle} to point to an <a
2143-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>.
2172+
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2173+
* are resolved relative to the current working directory. For empty array, clears the selected files.
21442174
*
2145-
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2146-
* are resolved relative to the the current working directory. For empty array, clears the selected files.
2175+
* <p> This method expects {@code ElementHandle} to point to an <a
2176+
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
2177+
* inside the {@code <label>} element that has an associated <a
2178+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, targets the control
2179+
* instead.
21472180
*/
21482181
default void setInputFiles(Path[] files) {
21492182
setInputFiles(files, null);
21502183
}
21512184
/**
2152-
* This method expects {@code elementHandle} to point to an <a
2153-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>.
2185+
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2186+
* are resolved relative to the current working directory. For empty array, clears the selected files.
21542187
*
2155-
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2156-
* are resolved relative to the the current working directory. For empty array, clears the selected files.
2188+
* <p> This method expects {@code ElementHandle} to point to an <a
2189+
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
2190+
* inside the {@code <label>} element that has an associated <a
2191+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, targets the control
2192+
* instead.
21572193
*/
21582194
void setInputFiles(Path[] files, SetInputFilesOptions options);
21592195
/**
2160-
* This method expects {@code elementHandle} to point to an <a
2161-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>.
2196+
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2197+
* are resolved relative to the current working directory. For empty array, clears the selected files.
21622198
*
2163-
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2164-
* are resolved relative to the the current working directory. For empty array, clears the selected files.
2199+
* <p> This method expects {@code ElementHandle} to point to an <a
2200+
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
2201+
* inside the {@code <label>} element that has an associated <a
2202+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, targets the control
2203+
* instead.
21652204
*/
21662205
default void setInputFiles(FilePayload files) {
21672206
setInputFiles(files, null);
21682207
}
21692208
/**
2170-
* This method expects {@code elementHandle} to point to an <a
2171-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>.
2209+
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2210+
* are resolved relative to the current working directory. For empty array, clears the selected files.
21722211
*
2173-
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2174-
* are resolved relative to the the current working directory. For empty array, clears the selected files.
2212+
* <p> This method expects {@code ElementHandle} to point to an <a
2213+
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
2214+
* inside the {@code <label>} element that has an associated <a
2215+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, targets the control
2216+
* instead.
21752217
*/
21762218
void setInputFiles(FilePayload files, SetInputFilesOptions options);
21772219
/**
2178-
* This method expects {@code elementHandle} to point to an <a
2179-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>.
2220+
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2221+
* are resolved relative to the current working directory. For empty array, clears the selected files.
21802222
*
2181-
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2182-
* are resolved relative to the the current working directory. For empty array, clears the selected files.
2223+
* <p> This method expects {@code ElementHandle} to point to an <a
2224+
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
2225+
* inside the {@code <label>} element that has an associated <a
2226+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, targets the control
2227+
* instead.
21832228
*/
21842229
default void setInputFiles(FilePayload[] files) {
21852230
setInputFiles(files, null);
21862231
}
21872232
/**
2188-
* This method expects {@code elementHandle} to point to an <a
2189-
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>.
2233+
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2234+
* are resolved relative to the current working directory. For empty array, clears the selected files.
21902235
*
2191-
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
2192-
* are resolved relative to the the current working directory. For empty array, clears the selected files.
2236+
* <p> This method expects {@code ElementHandle} to point to an <a
2237+
* href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">input element</a>. However, if the element is
2238+
* inside the {@code <label>} element that has an associated <a
2239+
* href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control</a>, targets the control
2240+
* instead.
21932241
*/
21942242
void setInputFiles(FilePayload[] files, SetInputFilesOptions options);
21952243
/**

playwright/src/main/java/com/microsoft/playwright/FileChooser.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,50 +74,50 @@ public SetFilesOptions setTimeout(double timeout) {
7474
Page page();
7575
/**
7676
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
77-
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
77+
* they are resolved relative to the current working directory. For empty array, clears the selected files.
7878
*/
7979
default void setFiles(Path files) {
8080
setFiles(files, null);
8181
}
8282
/**
8383
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
84-
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
84+
* they are resolved relative to the current working directory. For empty array, clears the selected files.
8585
*/
8686
void setFiles(Path files, SetFilesOptions options);
8787
/**
8888
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
89-
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
89+
* they are resolved relative to the current working directory. For empty array, clears the selected files.
9090
*/
9191
default void setFiles(Path[] files) {
9292
setFiles(files, null);
9393
}
9494
/**
9595
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
96-
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
96+
* they are resolved relative to the current working directory. For empty array, clears the selected files.
9797
*/
9898
void setFiles(Path[] files, SetFilesOptions options);
9999
/**
100100
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
101-
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
101+
* they are resolved relative to the current working directory. For empty array, clears the selected files.
102102
*/
103103
default void setFiles(FilePayload files) {
104104
setFiles(files, null);
105105
}
106106
/**
107107
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
108-
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
108+
* they are resolved relative to the current working directory. For empty array, clears the selected files.
109109
*/
110110
void setFiles(FilePayload files, SetFilesOptions options);
111111
/**
112112
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
113-
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
113+
* they are resolved relative to the current working directory. For empty array, clears the selected files.
114114
*/
115115
default void setFiles(FilePayload[] files) {
116116
setFiles(files, null);
117117
}
118118
/**
119119
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
120-
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
120+
* they are resolved relative to the current working directory. For empty array, clears the selected files.
121121
*/
122122
void setFiles(FilePayload[] files, SetFilesOptions options);
123123
}

0 commit comments

Comments
 (0)