1
0
mirror of synced 2026-08-05 06:56:56 +00:00

chore: roll driver, support new hasAttribute(name) (#1041)

This commit is contained in:
Yury Semikhatsky
2022-08-31 12:37:31 -07:00
committed by GitHub
parent 321673407a
commit 6b842e0d50
16 changed files with 210 additions and 168 deletions
+2 -2
View File
@@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->105.0.5195.28<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Chromium <!-- GEN:chromium-version -->105.0.5195.52<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| WebKit <!-- GEN:webkit-version -->16.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->103.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Firefox <!-- GEN:firefox-version -->104.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
Headless execution is supported for all the browsers on all platforms. Check out [system requirements](https://playwright.dev/java/docs/next/intro/#system-requirements) for details.
@@ -95,9 +95,6 @@ public interface Browser extends AutoCloseable {
/**
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
*
* <p> <strong>NOTE:</strong> It's not supported in WebKit, see <a href="https://bugs.webkit.org/show_bug.cgi?id=225281">here</a> in their issue
* tracker.
*/
public ForcedColors forcedColors;
public Geolocation geolocation;
@@ -284,9 +281,6 @@ public interface Browser extends AutoCloseable {
/**
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
*
* <p> <strong>NOTE:</strong> It's not supported in WebKit, see <a href="https://bugs.webkit.org/show_bug.cgi?id=225281">here</a> in their issue
* tracker.
*/
public NewContextOptions setForcedColors(ForcedColors forcedColors) {
this.forcedColors = forcedColors;
@@ -581,9 +575,6 @@ public interface Browser extends AutoCloseable {
/**
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
*
* <p> <strong>NOTE:</strong> It's not supported in WebKit, see <a href="https://bugs.webkit.org/show_bug.cgi?id=225281">here</a> in their issue
* tracker.
*/
public ForcedColors forcedColors;
public Geolocation geolocation;
@@ -770,9 +761,6 @@ public interface Browser extends AutoCloseable {
/**
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
*
* <p> <strong>NOTE:</strong> It's not supported in WebKit, see <a href="https://bugs.webkit.org/show_bug.cgi?id=225281">here</a> in their issue
* tracker.
*/
public NewPageOptions setForcedColors(ForcedColors forcedColors) {
this.forcedColors = forcedColors;
@@ -442,9 +442,6 @@ public interface BrowserType {
/**
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
*
* <p> <strong>NOTE:</strong> It's not supported in WebKit, see <a href="https://bugs.webkit.org/show_bug.cgi?id=225281">here</a> in their issue
* tracker.
*/
public ForcedColors forcedColors;
public Geolocation geolocation;
@@ -725,9 +722,6 @@ public interface BrowserType {
/**
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link Page#emulateMedia
* Page.emulateMedia()} for more details. Defaults to {@code "none"}.
*
* <p> <strong>NOTE:</strong> It's not supported in WebKit, see <a href="https://bugs.webkit.org/show_bug.cgi?id=225281">here</a> in their issue
* tracker.
*/
public LaunchPersistentContextOptions setForcedColors(ForcedColors forcedColors) {
this.forcedColors = forcedColors;
@@ -1166,7 +1166,7 @@ public interface ElementHandle extends JSHandle {
*/
public WaitForSelectorState state;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1193,7 +1193,7 @@ public interface ElementHandle extends JSHandle {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public WaitForSelectorOptions setStrict(boolean strict) {
@@ -167,7 +167,7 @@ public interface Frame {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -217,7 +217,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public CheckOptions setStrict(boolean strict) {
@@ -278,7 +278,7 @@ public interface Frame {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -357,7 +357,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public ClickOptions setStrict(boolean strict) {
@@ -414,7 +414,7 @@ public interface Frame {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -486,7 +486,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public DblclickOptions setStrict(boolean strict) {
@@ -514,7 +514,7 @@ public interface Frame {
}
class DispatchEventOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -526,7 +526,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public DispatchEventOptions setStrict(boolean strict) {
@@ -561,7 +561,7 @@ public interface Frame {
*/
public Position sourcePosition;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -616,7 +616,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public DragAndDropOptions setStrict(boolean strict) {
@@ -659,13 +659,13 @@ public interface Frame {
}
class EvalOnSelectorOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public EvalOnSelectorOptions setStrict(boolean strict) {
@@ -686,7 +686,7 @@ public interface Frame {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -715,7 +715,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public FillOptions setStrict(boolean strict) {
@@ -734,7 +734,7 @@ public interface Frame {
}
class FocusOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -746,7 +746,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public FocusOptions setStrict(boolean strict) {
@@ -765,7 +765,7 @@ public interface Frame {
}
class GetAttributeOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -777,7 +777,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public GetAttributeOptions setStrict(boolean strict) {
@@ -867,7 +867,7 @@ public interface Frame {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -916,7 +916,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public HoverOptions setStrict(boolean strict) {
@@ -944,7 +944,7 @@ public interface Frame {
}
class InnerHTMLOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -956,7 +956,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public InnerHTMLOptions setStrict(boolean strict) {
@@ -975,7 +975,7 @@ public interface Frame {
}
class InnerTextOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -987,7 +987,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public InnerTextOptions setStrict(boolean strict) {
@@ -1006,7 +1006,7 @@ public interface Frame {
}
class InputValueOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1018,7 +1018,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public InputValueOptions setStrict(boolean strict) {
@@ -1037,7 +1037,7 @@ public interface Frame {
}
class IsCheckedOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1049,7 +1049,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsCheckedOptions setStrict(boolean strict) {
@@ -1068,7 +1068,7 @@ public interface Frame {
}
class IsDisabledOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1080,7 +1080,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsDisabledOptions setStrict(boolean strict) {
@@ -1099,7 +1099,7 @@ public interface Frame {
}
class IsEditableOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1111,7 +1111,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsEditableOptions setStrict(boolean strict) {
@@ -1130,7 +1130,7 @@ public interface Frame {
}
class IsEnabledOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1142,7 +1142,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsEnabledOptions setStrict(boolean strict) {
@@ -1161,7 +1161,7 @@ public interface Frame {
}
class IsHiddenOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1172,7 +1172,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsHiddenOptions setStrict(boolean strict) {
@@ -1190,7 +1190,7 @@ public interface Frame {
}
class IsVisibleOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1201,7 +1201,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsVisibleOptions setStrict(boolean strict) {
@@ -1273,7 +1273,7 @@ public interface Frame {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1301,7 +1301,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public PressOptions setStrict(boolean strict) {
@@ -1320,13 +1320,13 @@ public interface Frame {
}
class QuerySelectorOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public QuerySelectorOptions setStrict(boolean strict) {
@@ -1347,7 +1347,7 @@ public interface Frame {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1376,7 +1376,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public SelectOptionOptions setStrict(boolean strict) {
@@ -1411,7 +1411,7 @@ public interface Frame {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1461,7 +1461,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public SetCheckedOptions setStrict(boolean strict) {
@@ -1538,7 +1538,7 @@ public interface Frame {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1559,7 +1559,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public SetInputFilesOptions setStrict(boolean strict) {
@@ -1599,7 +1599,7 @@ public interface Frame {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1657,7 +1657,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public TapOptions setStrict(boolean strict) {
@@ -1685,7 +1685,7 @@ public interface Frame {
}
class TextContentOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1697,7 +1697,7 @@ public interface Frame {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public TextContentOptions setStrict(boolean strict) {
@@ -1726,7 +1726,7 @@ public interface Frame {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1754,7 +1754,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public TypeOptions setStrict(boolean strict) {
@@ -1789,7 +1789,7 @@ public interface Frame {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1839,7 +1839,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public UncheckOptions setStrict(boolean strict) {
@@ -2004,7 +2004,7 @@ public interface Frame {
*/
public WaitForSelectorState state;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -2031,7 +2031,7 @@ public interface Frame {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public WaitForSelectorOptions setStrict(boolean strict) {
@@ -428,7 +428,7 @@ public interface Page extends AutoCloseable {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -478,7 +478,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public CheckOptions setStrict(boolean strict) {
@@ -539,7 +539,7 @@ public interface Page extends AutoCloseable {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -618,7 +618,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public ClickOptions setStrict(boolean strict) {
@@ -691,7 +691,7 @@ public interface Page extends AutoCloseable {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -763,7 +763,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public DblclickOptions setStrict(boolean strict) {
@@ -791,7 +791,7 @@ public interface Page extends AutoCloseable {
}
class DispatchEventOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -803,7 +803,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public DispatchEventOptions setStrict(boolean strict) {
@@ -838,7 +838,7 @@ public interface Page extends AutoCloseable {
*/
public Position sourcePosition;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -893,7 +893,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public DragAndDropOptions setStrict(boolean strict) {
@@ -943,9 +943,6 @@ public interface Page extends AutoCloseable {
/**
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"} and {@code "none"}. Passing {@code null} disables forced
* colors emulation.
*
* <p> <strong>NOTE:</strong> It's not supported in WebKit, see <a href="https://bugs.webkit.org/show_bug.cgi?id=225281">here</a> in their issue
* tracker.
*/
public Optional<ForcedColors> forcedColors;
/**
@@ -970,9 +967,6 @@ public interface Page extends AutoCloseable {
/**
* Emulates {@code "forced-colors"} media feature, supported values are {@code "active"} and {@code "none"}. Passing {@code null} disables forced
* colors emulation.
*
* <p> <strong>NOTE:</strong> It's not supported in WebKit, see <a href="https://bugs.webkit.org/show_bug.cgi?id=225281">here</a> in their issue
* tracker.
*/
public EmulateMediaOptions setForcedColors(ForcedColors forcedColors) {
this.forcedColors = Optional.ofNullable(forcedColors);
@@ -997,13 +991,13 @@ public interface Page extends AutoCloseable {
}
class EvalOnSelectorOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public EvalOnSelectorOptions setStrict(boolean strict) {
@@ -1040,7 +1034,7 @@ public interface Page extends AutoCloseable {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1069,7 +1063,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public FillOptions setStrict(boolean strict) {
@@ -1088,7 +1082,7 @@ public interface Page extends AutoCloseable {
}
class FocusOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1100,7 +1094,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public FocusOptions setStrict(boolean strict) {
@@ -1119,7 +1113,7 @@ public interface Page extends AutoCloseable {
}
class GetAttributeOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1131,7 +1125,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public GetAttributeOptions setStrict(boolean strict) {
@@ -1307,7 +1301,7 @@ public interface Page extends AutoCloseable {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1356,7 +1350,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public HoverOptions setStrict(boolean strict) {
@@ -1384,7 +1378,7 @@ public interface Page extends AutoCloseable {
}
class InnerHTMLOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1396,7 +1390,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public InnerHTMLOptions setStrict(boolean strict) {
@@ -1415,7 +1409,7 @@ public interface Page extends AutoCloseable {
}
class InnerTextOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1427,7 +1421,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public InnerTextOptions setStrict(boolean strict) {
@@ -1446,7 +1440,7 @@ public interface Page extends AutoCloseable {
}
class InputValueOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1458,7 +1452,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public InputValueOptions setStrict(boolean strict) {
@@ -1477,7 +1471,7 @@ public interface Page extends AutoCloseable {
}
class IsCheckedOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1489,7 +1483,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsCheckedOptions setStrict(boolean strict) {
@@ -1508,7 +1502,7 @@ public interface Page extends AutoCloseable {
}
class IsDisabledOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1520,7 +1514,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsDisabledOptions setStrict(boolean strict) {
@@ -1539,7 +1533,7 @@ public interface Page extends AutoCloseable {
}
class IsEditableOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1551,7 +1545,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsEditableOptions setStrict(boolean strict) {
@@ -1570,7 +1564,7 @@ public interface Page extends AutoCloseable {
}
class IsEnabledOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1582,7 +1576,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsEnabledOptions setStrict(boolean strict) {
@@ -1601,7 +1595,7 @@ public interface Page extends AutoCloseable {
}
class IsHiddenOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1612,7 +1606,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsHiddenOptions setStrict(boolean strict) {
@@ -1630,7 +1624,7 @@ public interface Page extends AutoCloseable {
}
class IsVisibleOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1641,7 +1635,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public IsVisibleOptions setStrict(boolean strict) {
@@ -1879,7 +1873,7 @@ public interface Page extends AutoCloseable {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -1907,7 +1901,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public PressOptions setStrict(boolean strict) {
@@ -1926,13 +1920,13 @@ public interface Page extends AutoCloseable {
}
class QuerySelectorOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public QuerySelectorOptions setStrict(boolean strict) {
@@ -2234,7 +2228,7 @@ public interface Page extends AutoCloseable {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -2263,7 +2257,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public SelectOptionOptions setStrict(boolean strict) {
@@ -2298,7 +2292,7 @@ public interface Page extends AutoCloseable {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -2348,7 +2342,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public SetCheckedOptions setStrict(boolean strict) {
@@ -2425,7 +2419,7 @@ public interface Page extends AutoCloseable {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -2446,7 +2440,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public SetInputFilesOptions setStrict(boolean strict) {
@@ -2486,7 +2480,7 @@ public interface Page extends AutoCloseable {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -2544,7 +2538,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public TapOptions setStrict(boolean strict) {
@@ -2572,7 +2566,7 @@ public interface Page extends AutoCloseable {
}
class TextContentOptions {
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -2584,7 +2578,7 @@ public interface Page extends AutoCloseable {
public Double timeout;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public TextContentOptions setStrict(boolean strict) {
@@ -2613,7 +2607,7 @@ public interface Page extends AutoCloseable {
*/
public Boolean noWaitAfter;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -2641,7 +2635,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public TypeOptions setStrict(boolean strict) {
@@ -2676,7 +2670,7 @@ public interface Page extends AutoCloseable {
*/
public Position position;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -2726,7 +2720,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public UncheckOptions setStrict(boolean strict) {
@@ -3076,7 +3070,7 @@ public interface Page extends AutoCloseable {
*/
public WaitForSelectorState state;
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public Boolean strict;
@@ -3103,7 +3097,7 @@ public interface Page extends AutoCloseable {
return this;
}
/**
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
* When true, the call requires selector to resolve to a single element. If given selector resolves to more than one
* element, the call throws an exception.
*/
public WaitForSelectorOptions setStrict(boolean strict) {
@@ -6645,7 +6639,7 @@ public interface Page extends AutoCloseable {
* {@code detached}.
*
* <p> <strong>NOTE:</strong> Playwright automatically waits for element to be ready before performing an action. Using {@code Locator} objects and
* web-first assertions make the code wait-for-selector-free.
* web-first assertions makes the code wait-for-selector-free.
*
* <p> Wait for the {@code selector} to satisfy {@code state} option (either appear/disappear from dom, or become visible/hidden). If at
* the moment of calling the method {@code selector} already satisfies the condition, the method will return immediately. If the
@@ -6683,7 +6677,7 @@ public interface Page extends AutoCloseable {
* {@code detached}.
*
* <p> <strong>NOTE:</strong> Playwright automatically waits for element to be ready before performing an action. Using {@code Locator} objects and
* web-first assertions make the code wait-for-selector-free.
* web-first assertions makes the code wait-for-selector-free.
*
* <p> Wait for the {@code selector} to satisfy {@code state} option (either appear/disappear from dom, or become visible/hidden). If at
* the moment of calling the method {@code selector} already satisfies the condition, the method will return immediately. If the
@@ -44,7 +44,7 @@ public interface Selectors {
/**
* An example of registering selector engine that queries elements based on a tag name:
* <pre>{@code
* // Script that evaluates to a selector engine instance.
* // Script that evaluates to a selector engine instance. The script is evaluated in the page context.
* String createTagNameEngine = "{\n" +
* " // Returns the first element matching given selector in the root's subtree.\n" +
* " query(root, selector) {\n" +
@@ -71,7 +71,7 @@ public interface Selectors {
*
* @param name Name that is used in selectors as a prefix, e.g. {@code {name: 'foo'}} enables {@code foo=myselectorbody} selectors. May only
* contain {@code [a-zA-Z0-9_]} characters.
* @param script Script that evaluates to a selector engine instance.
* @param script Script that evaluates to a selector engine instance. The script is evaluated in the page context.
*/
default void register(String name, String script) {
register(name, script, null);
@@ -79,7 +79,7 @@ public interface Selectors {
/**
* An example of registering selector engine that queries elements based on a tag name:
* <pre>{@code
* // Script that evaluates to a selector engine instance.
* // Script that evaluates to a selector engine instance. The script is evaluated in the page context.
* String createTagNameEngine = "{\n" +
* " // Returns the first element matching given selector in the root's subtree.\n" +
* " query(root, selector) {\n" +
@@ -106,13 +106,13 @@ public interface Selectors {
*
* @param name Name that is used in selectors as a prefix, e.g. {@code {name: 'foo'}} enables {@code foo=myselectorbody} selectors. May only
* contain {@code [a-zA-Z0-9_]} characters.
* @param script Script that evaluates to a selector engine instance.
* @param script Script that evaluates to a selector engine instance. The script is evaluated in the page context.
*/
void register(String name, String script, RegisterOptions options);
/**
* An example of registering selector engine that queries elements based on a tag name:
* <pre>{@code
* // Script that evaluates to a selector engine instance.
* // Script that evaluates to a selector engine instance. The script is evaluated in the page context.
* String createTagNameEngine = "{\n" +
* " // Returns the first element matching given selector in the root's subtree.\n" +
* " query(root, selector) {\n" +
@@ -139,7 +139,7 @@ public interface Selectors {
*
* @param name Name that is used in selectors as a prefix, e.g. {@code {name: 'foo'}} enables {@code foo=myselectorbody} selectors. May only
* contain {@code [a-zA-Z0-9_]} characters.
* @param script Script that evaluates to a selector engine instance.
* @param script Script that evaluates to a selector engine instance. The script is evaluated in the page context.
*/
default void register(String name, Path script) {
register(name, script, null);
@@ -147,7 +147,7 @@ public interface Selectors {
/**
* An example of registering selector engine that queries elements based on a tag name:
* <pre>{@code
* // Script that evaluates to a selector engine instance.
* // Script that evaluates to a selector engine instance. The script is evaluated in the page context.
* String createTagNameEngine = "{\n" +
* " // Returns the first element matching given selector in the root's subtree.\n" +
* " query(root, selector) {\n" +
@@ -174,7 +174,7 @@ public interface Selectors {
*
* @param name Name that is used in selectors as a prefix, e.g. {@code {name: 'foo'}} enables {@code foo=myselectorbody} selectors. May only
* contain {@code [a-zA-Z0-9_]} characters.
* @param script Script that evaluates to a selector engine instance.
* @param script Script that evaluates to a selector engine instance. The script is evaluated in the page context.
*/
void register(String name, Path script, RegisterOptions options);
}
@@ -46,7 +46,7 @@ public interface APIResponseAssertions {
*/
APIResponseAssertions not();
/**
* Ensures the response status code is within [200..299] range.
* Ensures the response status code is within {@code 200..299} range.
* <pre>{@code
* assertThat(response).isOK();
* }</pre>
@@ -780,7 +780,7 @@ public interface LocatorAssertions {
*/
void containsText(Pattern[] expected, ContainsTextOptions options);
/**
* Ensures the {@code Locator} points to an element with given attribute.
* Ensures the {@code Locator} points to an element with given attribute value.
* <pre>{@code
* assertThat(page.locator("input")).hasAttribute("type", "text");
* }</pre>
@@ -789,10 +789,10 @@ public interface LocatorAssertions {
* @param value Expected attribute value.
*/
default void hasAttribute(String name, String value) {
hasAttribute(name, value, null);
hasAttribute(name, value, (HasAttributeOptions) null);
}
/**
* Ensures the {@code Locator} points to an element with given attribute.
* Ensures the {@code Locator} points to an element with given attribute value.
* <pre>{@code
* assertThat(page.locator("input")).hasAttribute("type", "text");
* }</pre>
@@ -802,7 +802,7 @@ public interface LocatorAssertions {
*/
void hasAttribute(String name, String value, HasAttributeOptions options);
/**
* Ensures the {@code Locator} points to an element with given attribute.
* Ensures the {@code Locator} points to an element with given attribute value.
* <pre>{@code
* assertThat(page.locator("input")).hasAttribute("type", "text");
* }</pre>
@@ -811,10 +811,10 @@ public interface LocatorAssertions {
* @param value Expected attribute value.
*/
default void hasAttribute(String name, Pattern value) {
hasAttribute(name, value, null);
hasAttribute(name, value, (HasAttributeOptions) null);
}
/**
* Ensures the {@code Locator} points to an element with given attribute.
* Ensures the {@code Locator} points to an element with given attribute value.
* <pre>{@code
* assertThat(page.locator("input")).hasAttribute("type", "text");
* }</pre>
@@ -823,6 +823,28 @@ public interface LocatorAssertions {
* @param value Expected attribute value.
*/
void hasAttribute(String name, Pattern value, HasAttributeOptions options);
/**
* Ensures the {@code Locator} points to an element with given attribute. The method will assert attribute presence.
* <pre>{@code
* assertThat(page.locator("input")).hasAttribute("disabled");
* assertThat(page.locator("input")).not().hasAttribute("open");
* }</pre>
*
* @param name Attribute name.
*/
default void hasAttribute(String name) {
hasAttribute(name, (HasAttributeOptions) null);
}
/**
* Ensures the {@code Locator} points to an element with given attribute. The method will assert attribute presence.
* <pre>{@code
* assertThat(page.locator("input")).hasAttribute("disabled");
* assertThat(page.locator("input")).not().hasAttribute("open");
* }</pre>
*
* @param name Attribute name.
*/
void hasAttribute(String name, HasAttributeOptions options);
/**
* Ensures the {@code Locator} points to an element with given CSS classes. This needs to be a full match or using a relaxed
* regular expression.
@@ -105,7 +105,18 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
if (expectedValue instanceof Pattern) {
message += " matching regex";
}
expectImpl("to.have.attribute", expectedText, expectedValue, message, commonOptions);
expectImpl("to.have.attribute.value", expectedText, expectedValue, message, commonOptions);
}
@Override
public void hasAttribute(String name, HasAttributeOptions options) {
if (options == null) {
options = new HasAttributeOptions();
}
FrameExpectOptions commonOptions = convertType(options, FrameExpectOptions.class);
commonOptions.expressionArg = name;
String message = "Locator expected to have attribute '" + name + "'";
expectImpl("to.have.attribute", (List<ExpectedTextValue>) null, null, message, commonOptions);
}
@Override
@@ -31,10 +31,12 @@ import java.util.Map;
import static com.microsoft.playwright.impl.Utils.convertType;
public class RouteImpl extends ChannelOwner implements Route {
private final RequestImpl request;
private boolean handled;
public RouteImpl(ChannelOwner parent, String type, String guid, JsonObject initializer) {
super(parent, type, guid, initializer);
request = connection.getExistingObject(initializer.getAsJsonObject("request").get("guid").getAsString());
}
@Override
@@ -196,7 +198,7 @@ public class RouteImpl extends ChannelOwner implements Route {
@Override
public RequestImpl request() {
return connection.getExistingObject(initializer.getAsJsonObject("request").get("guid").getAsString());
return request;
}
void redirectNavigationRequest(String redirectURL) {
@@ -428,8 +428,8 @@ public class TestClick extends TestBase {
int expectedY = 18;
if (isWebKit()) {
// WebKit rounds up during css -> dip -> css conversion.
expectedX = 29;
expectedY = 19;
expectedX = 26;
expectedY = 17;
} else if (isChromium() && !headful) {
// Headless Chromium rounds down during css -> dip -> css conversion.
expectedX = 27;
@@ -284,6 +284,28 @@ public class TestLocatorAssertions extends TestBase {
assertTrue(e.getMessage().contains("Locator expected to have attribute 'id' matching regex: .Nod..\nReceived: node"), e.getMessage());
}
@Test
void hasAttributeBooleanPass() {
page.setContent("<div checked id=node>Text content</div>");
Locator locator = page.locator("#node");
assertThat(locator).hasAttribute("id");
assertThat(locator).hasAttribute("checked");
assertThat(locator).not().hasAttribute("open");
assertThat(locator).hasAttribute("id", Pattern.compile("n..e"));
}
@Test
void hasAttributeBooleanFail() {
page.setContent("<div checked id=node>Text content</div>");
Locator locator = page.locator("#node");
AssertionFailedError e = assertThrows(AssertionFailedError.class,
() -> assertThat(locator).hasAttribute("disabled", new LocatorAssertions.HasAttributeOptions().setTimeout(100)));
assertTrue(e.getMessage().contains("Locator expected to have attribute 'disabled'"), e.getMessage());
e = assertThrows(AssertionFailedError.class,
() -> assertThat(locator).not().hasAttribute("checked", new LocatorAssertions.HasAttributeOptions().setTimeout(100)));
assertTrue(e.getMessage().contains("Locator expected not to have attribute 'checked'"), e.getMessage());
}
@Test
void hasClassTextPass() {
page.setContent("<div class=\"foo bar baz\"></div>");
@@ -157,7 +157,11 @@ public class TestPageWaitForNavigation extends TestBase {
}
});
});
page.navigate(server.PREFIX + "/frames/one-frame.html");
try {
page.navigate(server.PREFIX + "/frames/one-frame.html", new Page.NavigateOptions().setTimeout(2000));
} catch (TimeoutError e) {
assertTrue(isWebKit()); // Chromium and Firefox issue load event in this case.
}
assertTrue(frameWindowStopCalled[0]);
}
+1 -1
View File
@@ -1 +1 @@
1.26.0-alpha-1660591492000
1.26.0-alpha-1661907180000
@@ -725,7 +725,12 @@ class Method extends Element {
String type = p.type.formatTypeFromUnion(overloadIndex);
argList.add("int".equals(type) ? "0" : "(" + type + ") null");
} else {
argList.add("int".equals(p.toJava()) ? "0" : "null");
String defaultValue = "null";
// TODO: it should probably be done for all methods that have name#1, name#2 etc overloads.
if ("LocatorAssertions.hasAttribute".equals(jsonPath)) {
defaultValue = "(" + p.type.toJava() + ") " + defaultValue;
}
argList.add(defaultValue);
}
continue;
}