From 170d07a0051ddd133e44f6d7fbafd08ed05af73a Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Mon, 14 Nov 2022 14:16:32 -0800 Subject: [PATCH] feat: roll driver to 1.29.0-alpha-1668454236000 (#1121) --- README.md | 2 +- .../com/microsoft/playwright/Browser.java | 56 ++-- .../com/microsoft/playwright/BrowserType.java | 28 +- .../microsoft/playwright/ElementHandle.java | 68 ----- .../java/com/microsoft/playwright/Frame.java | 273 ++++++++++-------- .../microsoft/playwright/FrameLocator.java | 186 ++++++++++-- .../com/microsoft/playwright/Locator.java | 184 ++++++++++-- .../java/com/microsoft/playwright/Page.java | 273 ++++++++++-------- .../playwright/impl/BrowserContextImpl.java | 10 +- .../playwright/impl/ElementHandleImpl.java | 5 - .../microsoft/playwright/impl/FrameImpl.java | 9 - .../playwright/impl/ListenerCollection.java | 33 ++- .../playwright/impl/LocatorUtils.java | 2 +- .../microsoft/playwright/impl/PageImpl.java | 51 +--- .../playwright/impl/Serialization.java | 2 +- .../playwright/TestElementHandleMisc.java | 10 - .../playwright/TestLocatorFrame.java | 4 +- .../microsoft/playwright/TestPageFill.java | 26 -- .../playwright/TestSelectorsGetBy.java | 36 ++- .../playwright/TestSelectorsRole.java | 25 +- scripts/CLI_VERSION | 2 +- 21 files changed, 763 insertions(+), 522 deletions(-) diff --git a/README.md b/README.md index 0f1c0e54..7e0d4779 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 107.0.5304.62 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 108.0.5359.40 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 16.0 | ✅ | ✅ | ✅ | | Firefox 106.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java index 4a38dbda..745970f8 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Browser.java +++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java @@ -81,9 +81,10 @@ public interface Browser extends AutoCloseable { public Boolean bypassCSP; /** * Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See - * {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}. + * {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. + * Defaults to {@code "light"}. */ - public ColorScheme colorScheme; + public Optional colorScheme; /** * Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. */ @@ -94,9 +95,9 @@ public interface Browser extends AutoCloseable { public Map extraHTTPHeaders; /** * 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"}. + * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}. */ - public ForcedColors forcedColors; + public Optional forcedColors; public Geolocation geolocation; /** * Specifies if viewport supports touch events. Defaults to false. @@ -176,9 +177,10 @@ public interface Browser extends AutoCloseable { public RecordVideoSize recordVideoSize; /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link - * Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}. + * Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to + * {@code "no-preference"}. */ - public ReducedMotion reducedMotion; + public Optional reducedMotion; /** * Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code viewport} * is set. @@ -258,10 +260,11 @@ public interface Browser extends AutoCloseable { } /** * Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See - * {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}. + * {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. + * Defaults to {@code "light"}. */ public NewContextOptions setColorScheme(ColorScheme colorScheme) { - this.colorScheme = colorScheme; + this.colorScheme = Optional.ofNullable(colorScheme); return this; } /** @@ -280,10 +283,10 @@ 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"}. + * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}. */ public NewContextOptions setForcedColors(ForcedColors forcedColors) { - this.forcedColors = forcedColors; + this.forcedColors = Optional.ofNullable(forcedColors); return this; } public NewContextOptions setGeolocation(double latitude, double longitude) { @@ -447,10 +450,11 @@ public interface Browser extends AutoCloseable { } /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link - * Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}. + * Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to + * {@code "no-preference"}. */ public NewContextOptions setReducedMotion(ReducedMotion reducedMotion) { - this.reducedMotion = reducedMotion; + this.reducedMotion = Optional.ofNullable(reducedMotion); return this; } /** @@ -561,9 +565,10 @@ public interface Browser extends AutoCloseable { public Boolean bypassCSP; /** * Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See - * {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}. + * {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. + * Defaults to {@code "light"}. */ - public ColorScheme colorScheme; + public Optional colorScheme; /** * Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. */ @@ -574,9 +579,9 @@ public interface Browser extends AutoCloseable { public Map extraHTTPHeaders; /** * 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"}. + * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}. */ - public ForcedColors forcedColors; + public Optional forcedColors; public Geolocation geolocation; /** * Specifies if viewport supports touch events. Defaults to false. @@ -656,9 +661,10 @@ public interface Browser extends AutoCloseable { public RecordVideoSize recordVideoSize; /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link - * Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}. + * Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to + * {@code "no-preference"}. */ - public ReducedMotion reducedMotion; + public Optional reducedMotion; /** * Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code viewport} * is set. @@ -738,10 +744,11 @@ public interface Browser extends AutoCloseable { } /** * Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See - * {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}. + * {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. + * Defaults to {@code "light"}. */ public NewPageOptions setColorScheme(ColorScheme colorScheme) { - this.colorScheme = colorScheme; + this.colorScheme = Optional.ofNullable(colorScheme); return this; } /** @@ -760,10 +767,10 @@ 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"}. + * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}. */ public NewPageOptions setForcedColors(ForcedColors forcedColors) { - this.forcedColors = forcedColors; + this.forcedColors = Optional.ofNullable(forcedColors); return this; } public NewPageOptions setGeolocation(double latitude, double longitude) { @@ -927,10 +934,11 @@ public interface Browser extends AutoCloseable { } /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link - * Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}. + * Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to + * {@code "no-preference"}. */ public NewPageOptions setReducedMotion(ReducedMotion reducedMotion) { - this.reducedMotion = reducedMotion; + this.reducedMotion = Optional.ofNullable(reducedMotion); return this; } /** diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index 78606ae1..62ba750b 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -407,9 +407,10 @@ public interface BrowserType { public Boolean chromiumSandbox; /** * Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See - * {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}. + * {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. + * Defaults to {@code "light"}. */ - public ColorScheme colorScheme; + public Optional colorScheme; /** * Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. */ @@ -441,9 +442,9 @@ public interface BrowserType { public Map extraHTTPHeaders; /** * 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"}. + * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}. */ - public ForcedColors forcedColors; + public Optional forcedColors; public Geolocation geolocation; /** * Close the browser process on SIGHUP. Defaults to {@code true}. @@ -548,9 +549,10 @@ public interface BrowserType { public RecordVideoSize recordVideoSize; /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link - * Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}. + * Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to + * {@code "no-preference"}. */ - public ReducedMotion reducedMotion; + public Optional reducedMotion; /** * Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code viewport} * is set. @@ -666,10 +668,11 @@ public interface BrowserType { } /** * Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code "no-preference"}. See - * {@link Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "light"}. + * {@link Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. + * Defaults to {@code "light"}. */ public LaunchPersistentContextOptions setColorScheme(ColorScheme colorScheme) { - this.colorScheme = colorScheme; + this.colorScheme = Optional.ofNullable(colorScheme); return this; } /** @@ -721,10 +724,10 @@ 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"}. + * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code "none"}. */ public LaunchPersistentContextOptions setForcedColors(ForcedColors forcedColors) { - this.forcedColors = forcedColors; + this.forcedColors = Optional.ofNullable(forcedColors); return this; } public LaunchPersistentContextOptions setGeolocation(double latitude, double longitude) { @@ -927,10 +930,11 @@ public interface BrowserType { } /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. See {@link - * Page#emulateMedia Page.emulateMedia()} for more details. Defaults to {@code "no-preference"}. + * Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to + * {@code "no-preference"}. */ public LaunchPersistentContextOptions setReducedMotion(ReducedMotion reducedMotion) { - this.reducedMotion = reducedMotion; + this.reducedMotion = Optional.ofNullable(reducedMotion); return this; } /** diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java index d8ed26bf..4c452af9 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -138,52 +138,6 @@ public interface ElementHandle extends JSHandle { return this; } } - class ClearOptions { - /** - * Whether to bypass the actionability checks. Defaults to - * {@code false}. - */ - public Boolean force; - /** - * Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can - * opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to - * inaccessible pages. Defaults to {@code false}. - */ - public Boolean noWaitAfter; - /** - * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by - * using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout - * Page.setDefaultTimeout()} methods. - */ - public Double timeout; - - /** - * Whether to bypass the actionability checks. Defaults to - * {@code false}. - */ - public ClearOptions setForce(boolean force) { - this.force = force; - return this; - } - /** - * Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can - * opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to - * inaccessible pages. Defaults to {@code false}. - */ - public ClearOptions setNoWaitAfter(boolean noWaitAfter) { - this.noWaitAfter = noWaitAfter; - return this; - } - /** - * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by - * using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link Page#setDefaultTimeout - * Page.setDefaultTimeout()} methods. - */ - public ClearOptions setTimeout(double timeout) { - this.timeout = timeout; - return this; - } - } class ClickOptions { /** * Defaults to {@code left}. @@ -1330,28 +1284,6 @@ public interface ElementHandle extends JSHandle { * zero timeout disables this. */ void check(CheckOptions options); - /** - * This method waits for actionability checks, focuses the - * element, clears it and triggers an {@code input} event after clearing. - * - *

If the target element is not an {@code }, {@code