From 89492da7d6bf8a310c37c65f993bc69a95d243d1 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 8 Jan 2021 18:29:49 -0800 Subject: [PATCH] fix: change some int types to double (#200) --- .github/workflows/test.yml | 6 - .../microsoft/playwright/Accessibility.java | 2 +- .../com/microsoft/playwright/Browser.java | 36 ++--- .../microsoft/playwright/BrowserContext.java | 14 +- .../com/microsoft/playwright/BrowserType.java | 50 +++--- .../microsoft/playwright/ElementHandle.java | 80 +++++----- .../com/microsoft/playwright/FileChooser.java | 4 +- .../java/com/microsoft/playwright/Frame.java | 96 ++++++------ .../java/com/microsoft/playwright/Mouse.java | 24 +-- .../java/com/microsoft/playwright/Page.java | 142 +++++++++--------- .../com/microsoft/playwright/Selectors.java | 2 +- .../com/microsoft/playwright/Touchscreen.java | 2 +- .../com/microsoft/playwright/WebSocket.java | 4 +- .../playwright/impl/BrowserContextImpl.java | 4 +- .../microsoft/playwright/impl/FrameImpl.java | 4 +- .../microsoft/playwright/impl/MouseImpl.java | 12 +- .../microsoft/playwright/impl/PageImpl.java | 10 +- .../playwright/impl/TimeoutSettings.java | 14 +- .../playwright/impl/TouchscreenImpl.java | 2 +- .../playwright/impl/WaitableTimeout.java | 10 +- .../playwright/tools/ApiGenerator.java | 15 +- .../com/microsoft/playwright/tools/Types.java | 26 ---- 22 files changed, 269 insertions(+), 290 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b0927f53..2b695a46 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,12 +26,6 @@ jobs: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 -# - name: Cache Downloaded Drivers -# uses: actions/cache@v2 -# with: -# path: driver-bundle/src/main/resources/driver -# key: ${{ runner.os }}-drivers-${{ hashFiles('scripts/*') }} -# restore-keys: ${{ runner.os }}-drivers - name: Download drivers shell: bash run: scripts/download_driver_for_all_platforms.sh diff --git a/playwright/src/main/java/com/microsoft/playwright/Accessibility.java b/playwright/src/main/java/com/microsoft/playwright/Accessibility.java index 94cac91d..19399666 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Accessibility.java +++ b/playwright/src/main/java/com/microsoft/playwright/Accessibility.java @@ -50,7 +50,7 @@ public interface Accessibility { */ public ElementHandle root; - public SnapshotOptions withInterestingOnly(Boolean interestingOnly) { + public SnapshotOptions withInterestingOnly(boolean interestingOnly) { this.interestingOnly = interestingOnly; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java index 3564ca55..8a94604d 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Browser.java +++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java @@ -118,7 +118,7 @@ public interface Browser { return NewContextOptions.this; } - public RecordHar withOmitContent(Boolean omitContent) { + public RecordHar withOmitContent(boolean omitContent) { this.omitContent = omitContent; return this; } @@ -249,11 +249,11 @@ public interface Browser { */ public Page.Viewport viewport; - public NewContextOptions withAcceptDownloads(Boolean acceptDownloads) { + public NewContextOptions withAcceptDownloads(boolean acceptDownloads) { this.acceptDownloads = acceptDownloads; return this; } - public NewContextOptions withBypassCSP(Boolean bypassCSP) { + public NewContextOptions withBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; return this; } @@ -261,7 +261,7 @@ public interface Browser { this.colorScheme = colorScheme; return this; } - public NewContextOptions withDeviceScaleFactor(Double deviceScaleFactor) { + public NewContextOptions withDeviceScaleFactor(double deviceScaleFactor) { this.deviceScaleFactor = deviceScaleFactor; return this; } @@ -273,7 +273,7 @@ public interface Browser { this.geolocation = geolocation; return this; } - public NewContextOptions withHasTouch(Boolean hasTouch) { + public NewContextOptions withHasTouch(boolean hasTouch) { this.hasTouch = hasTouch; return this; } @@ -281,15 +281,15 @@ public interface Browser { this.httpCredentials = new BrowserContext.HTTPCredentials(username, password); return this; } - public NewContextOptions withIgnoreHTTPSErrors(Boolean ignoreHTTPSErrors) { + public NewContextOptions withIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { this.ignoreHTTPSErrors = ignoreHTTPSErrors; return this; } - public NewContextOptions withIsMobile(Boolean isMobile) { + public NewContextOptions withIsMobile(boolean isMobile) { this.isMobile = isMobile; return this; } - public NewContextOptions withJavaScriptEnabled(Boolean javaScriptEnabled) { + public NewContextOptions withJavaScriptEnabled(boolean javaScriptEnabled) { this.javaScriptEnabled = javaScriptEnabled; return this; } @@ -297,7 +297,7 @@ public interface Browser { this.locale = locale; return this; } - public NewContextOptions withOffline(Boolean offline) { + public NewContextOptions withOffline(boolean offline) { this.offline = offline; return this; } @@ -407,7 +407,7 @@ public interface Browser { return NewPageOptions.this; } - public RecordHar withOmitContent(Boolean omitContent) { + public RecordHar withOmitContent(boolean omitContent) { this.omitContent = omitContent; return this; } @@ -538,11 +538,11 @@ public interface Browser { */ public Page.Viewport viewport; - public NewPageOptions withAcceptDownloads(Boolean acceptDownloads) { + public NewPageOptions withAcceptDownloads(boolean acceptDownloads) { this.acceptDownloads = acceptDownloads; return this; } - public NewPageOptions withBypassCSP(Boolean bypassCSP) { + public NewPageOptions withBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; return this; } @@ -550,7 +550,7 @@ public interface Browser { this.colorScheme = colorScheme; return this; } - public NewPageOptions withDeviceScaleFactor(Double deviceScaleFactor) { + public NewPageOptions withDeviceScaleFactor(double deviceScaleFactor) { this.deviceScaleFactor = deviceScaleFactor; return this; } @@ -562,7 +562,7 @@ public interface Browser { this.geolocation = geolocation; return this; } - public NewPageOptions withHasTouch(Boolean hasTouch) { + public NewPageOptions withHasTouch(boolean hasTouch) { this.hasTouch = hasTouch; return this; } @@ -570,15 +570,15 @@ public interface Browser { this.httpCredentials = new BrowserContext.HTTPCredentials(username, password); return this; } - public NewPageOptions withIgnoreHTTPSErrors(Boolean ignoreHTTPSErrors) { + public NewPageOptions withIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { this.ignoreHTTPSErrors = ignoreHTTPSErrors; return this; } - public NewPageOptions withIsMobile(Boolean isMobile) { + public NewPageOptions withIsMobile(boolean isMobile) { this.isMobile = isMobile; return this; } - public NewPageOptions withJavaScriptEnabled(Boolean javaScriptEnabled) { + public NewPageOptions withJavaScriptEnabled(boolean javaScriptEnabled) { this.javaScriptEnabled = javaScriptEnabled; return this; } @@ -586,7 +586,7 @@ public interface Browser { this.locale = locale; return this; } - public NewPageOptions withOffline(Boolean offline) { + public NewPageOptions withOffline(boolean offline) { this.offline = offline; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java index 02715bde..70a29e9d 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java @@ -100,9 +100,9 @@ public interface BrowserContext { } class FutureEventOptions { - public Integer timeout; + public Double timeout; public Predicate> predicate; - public FutureEventOptions withTimeout(int millis) { + public FutureEventOptions withTimeout(double millis) { timeout = millis; return this; } @@ -181,11 +181,11 @@ public interface BrowserContext { this.expires = expires; return this; } - public AddCookie withHttpOnly(Boolean httpOnly) { + public AddCookie withHttpOnly(boolean httpOnly) { this.httpOnly = httpOnly; return this; } - public AddCookie withSecure(Boolean secure) { + public AddCookie withSecure(boolean secure) { this.secure = secure; return this; } @@ -239,7 +239,7 @@ public interface BrowserContext { */ public Boolean handle; - public ExposeBindingOptions withHandle(Boolean handle) { + public ExposeBindingOptions withHandle(boolean handle) { this.handle = handle; return this; } @@ -453,7 +453,7 @@ public interface BrowserContext { * [{@code method: BrowserContext.setDefaultNavigationTimeout}]. * @param timeout Maximum navigation time in milliseconds */ - void setDefaultNavigationTimeout(int timeout); + void setDefaultNavigationTimeout(double timeout); /** * This setting will change the default maximum time for all the methods accepting {@code timeout} option. *

@@ -462,7 +462,7 @@ public interface BrowserContext { * [{@code method: BrowserContext.setDefaultNavigationTimeout}] take priority over [{@code method: BrowserContext.setDefaultTimeout}]. * @param timeout Maximum time in milliseconds */ - void setDefaultTimeout(int timeout); + void setDefaultTimeout(double timeout); /** * The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are merged *

diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index 0237c235..01fff422 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -148,11 +148,11 @@ public interface BrowserType { this.args = args; return this; } - public LaunchOptions withChromiumSandbox(Boolean chromiumSandbox) { + public LaunchOptions withChromiumSandbox(boolean chromiumSandbox) { this.chromiumSandbox = chromiumSandbox; return this; } - public LaunchOptions withDevtools(Boolean devtools) { + public LaunchOptions withDevtools(boolean devtools) { this.devtools = devtools; return this; } @@ -172,19 +172,19 @@ public interface BrowserType { this.firefoxUserPrefs = firefoxUserPrefs; return this; } - public LaunchOptions withHandleSIGHUP(Boolean handleSIGHUP) { + public LaunchOptions withHandleSIGHUP(boolean handleSIGHUP) { this.handleSIGHUP = handleSIGHUP; return this; } - public LaunchOptions withHandleSIGINT(Boolean handleSIGINT) { + public LaunchOptions withHandleSIGINT(boolean handleSIGINT) { this.handleSIGINT = handleSIGINT; return this; } - public LaunchOptions withHandleSIGTERM(Boolean handleSIGTERM) { + public LaunchOptions withHandleSIGTERM(boolean handleSIGTERM) { this.handleSIGTERM = handleSIGTERM; return this; } - public LaunchOptions withHeadless(Boolean headless) { + public LaunchOptions withHeadless(boolean headless) { this.headless = headless; return this; } @@ -200,11 +200,11 @@ public interface BrowserType { this.proxy = new Proxy(); return this.proxy; } - public LaunchOptions withSlowMo(Double slowMo) { + public LaunchOptions withSlowMo(double slowMo) { this.slowMo = slowMo; return this; } - public LaunchOptions withTimeout(Double timeout) { + public LaunchOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -268,7 +268,7 @@ public interface BrowserType { return LaunchPersistentContextOptions.this; } - public RecordHar withOmitContent(Boolean omitContent) { + public RecordHar withOmitContent(boolean omitContent) { this.omitContent = omitContent; return this; } @@ -479,7 +479,7 @@ public interface BrowserType { */ public Page.Viewport viewport; - public LaunchPersistentContextOptions withAcceptDownloads(Boolean acceptDownloads) { + public LaunchPersistentContextOptions withAcceptDownloads(boolean acceptDownloads) { this.acceptDownloads = acceptDownloads; return this; } @@ -487,11 +487,11 @@ public interface BrowserType { this.args = args; return this; } - public LaunchPersistentContextOptions withBypassCSP(Boolean bypassCSP) { + public LaunchPersistentContextOptions withBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; return this; } - public LaunchPersistentContextOptions withChromiumSandbox(Boolean chromiumSandbox) { + public LaunchPersistentContextOptions withChromiumSandbox(boolean chromiumSandbox) { this.chromiumSandbox = chromiumSandbox; return this; } @@ -499,11 +499,11 @@ public interface BrowserType { this.colorScheme = colorScheme; return this; } - public LaunchPersistentContextOptions withDeviceScaleFactor(Double deviceScaleFactor) { + public LaunchPersistentContextOptions withDeviceScaleFactor(double deviceScaleFactor) { this.deviceScaleFactor = deviceScaleFactor; return this; } - public LaunchPersistentContextOptions withDevtools(Boolean devtools) { + public LaunchPersistentContextOptions withDevtools(boolean devtools) { this.devtools = devtools; return this; } @@ -527,23 +527,23 @@ public interface BrowserType { this.geolocation = geolocation; return this; } - public LaunchPersistentContextOptions withHandleSIGHUP(Boolean handleSIGHUP) { + public LaunchPersistentContextOptions withHandleSIGHUP(boolean handleSIGHUP) { this.handleSIGHUP = handleSIGHUP; return this; } - public LaunchPersistentContextOptions withHandleSIGINT(Boolean handleSIGINT) { + public LaunchPersistentContextOptions withHandleSIGINT(boolean handleSIGINT) { this.handleSIGINT = handleSIGINT; return this; } - public LaunchPersistentContextOptions withHandleSIGTERM(Boolean handleSIGTERM) { + public LaunchPersistentContextOptions withHandleSIGTERM(boolean handleSIGTERM) { this.handleSIGTERM = handleSIGTERM; return this; } - public LaunchPersistentContextOptions withHasTouch(Boolean hasTouch) { + public LaunchPersistentContextOptions withHasTouch(boolean hasTouch) { this.hasTouch = hasTouch; return this; } - public LaunchPersistentContextOptions withHeadless(Boolean headless) { + public LaunchPersistentContextOptions withHeadless(boolean headless) { this.headless = headless; return this; } @@ -559,15 +559,15 @@ public interface BrowserType { this.ignoreAllDefaultArgs = ignore; return this; } - public LaunchPersistentContextOptions withIgnoreHTTPSErrors(Boolean ignoreHTTPSErrors) { + public LaunchPersistentContextOptions withIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { this.ignoreHTTPSErrors = ignoreHTTPSErrors; return this; } - public LaunchPersistentContextOptions withIsMobile(Boolean isMobile) { + public LaunchPersistentContextOptions withIsMobile(boolean isMobile) { this.isMobile = isMobile; return this; } - public LaunchPersistentContextOptions withJavaScriptEnabled(Boolean javaScriptEnabled) { + public LaunchPersistentContextOptions withJavaScriptEnabled(boolean javaScriptEnabled) { this.javaScriptEnabled = javaScriptEnabled; return this; } @@ -575,7 +575,7 @@ public interface BrowserType { this.locale = locale; return this; } - public LaunchPersistentContextOptions withOffline(Boolean offline) { + public LaunchPersistentContextOptions withOffline(boolean offline) { this.offline = offline; return this; } @@ -595,11 +595,11 @@ public interface BrowserType { this.recordVideo = new RecordVideo(); return this.recordVideo; } - public LaunchPersistentContextOptions withSlowMo(Double slowMo) { + public LaunchPersistentContextOptions withSlowMo(double slowMo) { this.slowMo = slowMo; return this; } - public LaunchPersistentContextOptions withTimeout(Double timeout) { + public LaunchPersistentContextOptions withTimeout(double timeout) { this.timeout = timeout; 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 19707733..2f496236 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -77,15 +77,15 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public CheckOptions withForce(Boolean force) { + public CheckOptions withForce(boolean force) { this.force = force; return this; } - public CheckOptions withNoWaitAfter(Boolean noWaitAfter) { + public CheckOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public CheckOptions withTimeout(Double timeout) { + public CheckOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -133,15 +133,15 @@ public interface ElementHandle extends JSHandle { this.button = button; return this; } - public ClickOptions withClickCount(Integer clickCount) { + public ClickOptions withClickCount(int clickCount) { this.clickCount = clickCount; return this; } - public ClickOptions withDelay(Double delay) { + public ClickOptions withDelay(double delay) { this.delay = delay; return this; } - public ClickOptions withForce(Boolean force) { + public ClickOptions withForce(boolean force) { this.force = force; return this; } @@ -149,7 +149,7 @@ public interface ElementHandle extends JSHandle { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public ClickOptions withNoWaitAfter(Boolean noWaitAfter) { + public ClickOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -160,7 +160,7 @@ public interface ElementHandle extends JSHandle { public ClickOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public ClickOptions withTimeout(Double timeout) { + public ClickOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -204,11 +204,11 @@ public interface ElementHandle extends JSHandle { this.button = button; return this; } - public DblclickOptions withDelay(Double delay) { + public DblclickOptions withDelay(double delay) { this.delay = delay; return this; } - public DblclickOptions withForce(Boolean force) { + public DblclickOptions withForce(boolean force) { this.force = force; return this; } @@ -216,7 +216,7 @@ public interface ElementHandle extends JSHandle { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public DblclickOptions withNoWaitAfter(Boolean noWaitAfter) { + public DblclickOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -227,7 +227,7 @@ public interface ElementHandle extends JSHandle { public DblclickOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public DblclickOptions withTimeout(Double timeout) { + public DblclickOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -245,11 +245,11 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public FillOptions withNoWaitAfter(Boolean noWaitAfter) { + public FillOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public FillOptions withTimeout(Double timeout) { + public FillOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -275,7 +275,7 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public HoverOptions withForce(Boolean force) { + public HoverOptions withForce(boolean force) { this.force = force; return this; } @@ -290,7 +290,7 @@ public interface ElementHandle extends JSHandle { public HoverOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public HoverOptions withTimeout(Double timeout) { + public HoverOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -312,15 +312,15 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public PressOptions withDelay(Double delay) { + public PressOptions withDelay(double delay) { this.delay = delay; return this; } - public PressOptions withNoWaitAfter(Boolean noWaitAfter) { + public PressOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public PressOptions withTimeout(Double timeout) { + public PressOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -352,7 +352,7 @@ public interface ElementHandle extends JSHandle { */ public Type type; - public ScreenshotOptions withOmitBackground(Boolean omitBackground) { + public ScreenshotOptions withOmitBackground(boolean omitBackground) { this.omitBackground = omitBackground; return this; } @@ -360,11 +360,11 @@ public interface ElementHandle extends JSHandle { this.path = path; return this; } - public ScreenshotOptions withQuality(Integer quality) { + public ScreenshotOptions withQuality(int quality) { this.quality = quality; return this; } - public ScreenshotOptions withTimeout(Double timeout) { + public ScreenshotOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -380,7 +380,7 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public ScrollIntoViewIfNeededOptions withTimeout(Double timeout) { + public ScrollIntoViewIfNeededOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -398,11 +398,11 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public SelectOptionOptions withNoWaitAfter(Boolean noWaitAfter) { + public SelectOptionOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SelectOptionOptions withTimeout(Double timeout) { + public SelectOptionOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -414,7 +414,7 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public SelectTextOptions withTimeout(Double timeout) { + public SelectTextOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -432,11 +432,11 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public SetInputFilesOptions withNoWaitAfter(Boolean noWaitAfter) { + public SetInputFilesOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SetInputFilesOptions withTimeout(Double timeout) { + public SetInputFilesOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -487,7 +487,7 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public TapOptions withForce(Boolean force) { + public TapOptions withForce(boolean force) { this.force = force; return this; } @@ -495,7 +495,7 @@ public interface ElementHandle extends JSHandle { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public TapOptions withNoWaitAfter(Boolean noWaitAfter) { + public TapOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -503,7 +503,7 @@ public interface ElementHandle extends JSHandle { this.position = new Position(); return this.position; } - public TapOptions withTimeout(Double timeout) { + public TapOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -525,15 +525,15 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public TypeOptions withDelay(Double delay) { + public TypeOptions withDelay(double delay) { this.delay = delay; return this; } - public TypeOptions withNoWaitAfter(Boolean noWaitAfter) { + public TypeOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TypeOptions withTimeout(Double timeout) { + public TypeOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -555,15 +555,15 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public UncheckOptions withForce(Boolean force) { + public UncheckOptions withForce(boolean force) { this.force = force; return this; } - public UncheckOptions withNoWaitAfter(Boolean noWaitAfter) { + public UncheckOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public UncheckOptions withTimeout(Double timeout) { + public UncheckOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -573,9 +573,9 @@ public interface ElementHandle extends JSHandle { * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by * using the [{@code method: BrowserContext.setDefaultTimeout}] or [{@code method: Page.setDefaultTimeout}] methods. */ - public Integer timeout; + public Double timeout; - public WaitForElementStateOptions withTimeout(Integer timeout) { + public WaitForElementStateOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -602,7 +602,7 @@ public interface ElementHandle extends JSHandle { this.state = state; return this; } - public WaitForSelectorOptions withTimeout(Double timeout) { + public WaitForSelectorOptions withTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/FileChooser.java b/playwright/src/main/java/com/microsoft/playwright/FileChooser.java index 9d4cb517..9e13bb55 100644 --- a/playwright/src/main/java/com/microsoft/playwright/FileChooser.java +++ b/playwright/src/main/java/com/microsoft/playwright/FileChooser.java @@ -51,11 +51,11 @@ public interface FileChooser { */ public Double timeout; - public SetFilesOptions withNoWaitAfter(Boolean noWaitAfter) { + public SetFilesOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SetFilesOptions withTimeout(Double timeout) { + public SetFilesOptions withTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Frame.java b/playwright/src/main/java/com/microsoft/playwright/Frame.java index 56a157d4..e9cca4cf 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Frame.java +++ b/playwright/src/main/java/com/microsoft/playwright/Frame.java @@ -127,15 +127,15 @@ public interface Frame { */ public Double timeout; - public CheckOptions withForce(Boolean force) { + public CheckOptions withForce(boolean force) { this.force = force; return this; } - public CheckOptions withNoWaitAfter(Boolean noWaitAfter) { + public CheckOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public CheckOptions withTimeout(Double timeout) { + public CheckOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -183,15 +183,15 @@ public interface Frame { this.button = button; return this; } - public ClickOptions withClickCount(Integer clickCount) { + public ClickOptions withClickCount(int clickCount) { this.clickCount = clickCount; return this; } - public ClickOptions withDelay(Double delay) { + public ClickOptions withDelay(double delay) { this.delay = delay; return this; } - public ClickOptions withForce(Boolean force) { + public ClickOptions withForce(boolean force) { this.force = force; return this; } @@ -199,7 +199,7 @@ public interface Frame { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public ClickOptions withNoWaitAfter(Boolean noWaitAfter) { + public ClickOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -210,7 +210,7 @@ public interface Frame { public ClickOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public ClickOptions withTimeout(Double timeout) { + public ClickOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -254,11 +254,11 @@ public interface Frame { this.button = button; return this; } - public DblclickOptions withDelay(Double delay) { + public DblclickOptions withDelay(double delay) { this.delay = delay; return this; } - public DblclickOptions withForce(Boolean force) { + public DblclickOptions withForce(boolean force) { this.force = force; return this; } @@ -266,7 +266,7 @@ public interface Frame { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public DblclickOptions withNoWaitAfter(Boolean noWaitAfter) { + public DblclickOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -277,7 +277,7 @@ public interface Frame { public DblclickOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public DblclickOptions withTimeout(Double timeout) { + public DblclickOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -289,7 +289,7 @@ public interface Frame { */ public Double timeout; - public DispatchEventOptions withTimeout(Double timeout) { + public DispatchEventOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -307,11 +307,11 @@ public interface Frame { */ public Double timeout; - public FillOptions withNoWaitAfter(Boolean noWaitAfter) { + public FillOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public FillOptions withTimeout(Double timeout) { + public FillOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -323,7 +323,7 @@ public interface Frame { */ public Double timeout; - public FocusOptions withTimeout(Double timeout) { + public FocusOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -335,7 +335,7 @@ public interface Frame { */ public Double timeout; - public GetAttributeOptions withTimeout(Double timeout) { + public GetAttributeOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -352,7 +352,7 @@ public interface Frame { * [{@code method: BrowserContext.setDefaultTimeout}], [{@code method: Page.setDefaultNavigationTimeout}] or * [{@code method: Page.setDefaultTimeout}] methods. */ - public Integer timeout; + public Double timeout; /** * When to consider operation succeeded, defaults to {@code load}. Events can be either: * - {@code 'domcontentloaded'} - consider operation to be finished when the {@code DOMContentLoaded} event is fired. @@ -365,7 +365,7 @@ public interface Frame { this.referer = referer; return this; } - public NavigateOptions withTimeout(Integer timeout) { + public NavigateOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -395,7 +395,7 @@ public interface Frame { */ public Double timeout; - public HoverOptions withForce(Boolean force) { + public HoverOptions withForce(boolean force) { this.force = force; return this; } @@ -410,7 +410,7 @@ public interface Frame { public HoverOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public HoverOptions withTimeout(Double timeout) { + public HoverOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -422,7 +422,7 @@ public interface Frame { */ public Double timeout; - public InnerHTMLOptions withTimeout(Double timeout) { + public InnerHTMLOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -434,7 +434,7 @@ public interface Frame { */ public Double timeout; - public InnerTextOptions withTimeout(Double timeout) { + public InnerTextOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -456,15 +456,15 @@ public interface Frame { */ public Double timeout; - public PressOptions withDelay(Double delay) { + public PressOptions withDelay(double delay) { this.delay = delay; return this; } - public PressOptions withNoWaitAfter(Boolean noWaitAfter) { + public PressOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public PressOptions withTimeout(Double timeout) { + public PressOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -482,11 +482,11 @@ public interface Frame { */ public Double timeout; - public SelectOptionOptions withNoWaitAfter(Boolean noWaitAfter) { + public SelectOptionOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SelectOptionOptions withTimeout(Double timeout) { + public SelectOptionOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -507,7 +507,7 @@ public interface Frame { */ public LoadState waitUntil; - public SetContentOptions withTimeout(Double timeout) { + public SetContentOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -529,11 +529,11 @@ public interface Frame { */ public Double timeout; - public SetInputFilesOptions withNoWaitAfter(Boolean noWaitAfter) { + public SetInputFilesOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SetInputFilesOptions withTimeout(Double timeout) { + public SetInputFilesOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -584,7 +584,7 @@ public interface Frame { */ public Double timeout; - public TapOptions withForce(Boolean force) { + public TapOptions withForce(boolean force) { this.force = force; return this; } @@ -592,7 +592,7 @@ public interface Frame { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public TapOptions withNoWaitAfter(Boolean noWaitAfter) { + public TapOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -600,7 +600,7 @@ public interface Frame { this.position = new Position(); return this.position; } - public TapOptions withTimeout(Double timeout) { + public TapOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -612,7 +612,7 @@ public interface Frame { */ public Double timeout; - public TextContentOptions withTimeout(Double timeout) { + public TextContentOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -634,15 +634,15 @@ public interface Frame { */ public Double timeout; - public TypeOptions withDelay(Double delay) { + public TypeOptions withDelay(double delay) { this.delay = delay; return this; } - public TypeOptions withNoWaitAfter(Boolean noWaitAfter) { + public TypeOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TypeOptions withTimeout(Double timeout) { + public TypeOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -664,15 +664,15 @@ public interface Frame { */ public Double timeout; - public UncheckOptions withForce(Boolean force) { + public UncheckOptions withForce(boolean force) { this.force = force; return this; } - public UncheckOptions withNoWaitAfter(Boolean noWaitAfter) { + public UncheckOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public UncheckOptions withTimeout(Double timeout) { + public UncheckOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -697,7 +697,7 @@ public interface Frame { this.pollingInterval = millis; return this; } - public WaitForFunctionOptions withTimeout(Double timeout) { + public WaitForFunctionOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -709,9 +709,9 @@ public interface Frame { * [{@code method: BrowserContext.setDefaultTimeout}], [{@code method: Page.setDefaultNavigationTimeout}] or * [{@code method: Page.setDefaultTimeout}] methods. */ - public Integer timeout; + public Double timeout; - public WaitForLoadStateOptions withTimeout(Integer timeout) { + public WaitForLoadStateOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -723,7 +723,7 @@ public interface Frame { * [{@code method: BrowserContext.setDefaultTimeout}], [{@code method: Page.setDefaultNavigationTimeout}] or * [{@code method: Page.setDefaultTimeout}] methods. */ - public Integer timeout; + public Double timeout; /** * URL string, URL regex pattern or predicate receiving [URL] to match while waiting for the navigation. */ @@ -738,7 +738,7 @@ public interface Frame { */ public LoadState waitUntil; - public FutureNavigationOptions withTimeout(Integer timeout) { + public FutureNavigationOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -781,7 +781,7 @@ public interface Frame { this.state = state; return this; } - public WaitForSelectorOptions withTimeout(Double timeout) { + public WaitForSelectorOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1519,6 +1519,6 @@ public interface Frame { * be flaky. Use signals such as network events, selectors becoming visible and others instead. * @param timeout A timeout to wait for */ - void waitForTimeout(int timeout); + void waitForTimeout(double timeout); } diff --git a/playwright/src/main/java/com/microsoft/playwright/Mouse.java b/playwright/src/main/java/com/microsoft/playwright/Mouse.java index c6f1217f..e38beafc 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Mouse.java +++ b/playwright/src/main/java/com/microsoft/playwright/Mouse.java @@ -47,11 +47,11 @@ public interface Mouse { this.button = button; return this; } - public ClickOptions withClickCount(Integer clickCount) { + public ClickOptions withClickCount(int clickCount) { this.clickCount = clickCount; return this; } - public ClickOptions withDelay(Double delay) { + public ClickOptions withDelay(double delay) { this.delay = delay; return this; } @@ -70,7 +70,7 @@ public interface Mouse { this.button = button; return this; } - public DblclickOptions withDelay(Double delay) { + public DblclickOptions withDelay(double delay) { this.delay = delay; return this; } @@ -89,7 +89,7 @@ public interface Mouse { this.button = button; return this; } - public DownOptions withClickCount(Integer clickCount) { + public DownOptions withClickCount(int clickCount) { this.clickCount = clickCount; return this; } @@ -100,7 +100,7 @@ public interface Mouse { */ public Integer steps; - public MoveOptions withSteps(Integer steps) { + public MoveOptions withSteps(int steps) { this.steps = steps; return this; } @@ -119,19 +119,19 @@ public interface Mouse { this.button = button; return this; } - public UpOptions withClickCount(Integer clickCount) { + public UpOptions withClickCount(int clickCount) { this.clickCount = clickCount; return this; } } - default void click(int x, int y) { + default void click(double x, double y) { click(x, y, null); } /** * Shortcut for [{@code method: Mouse.move}], [{@code method: Mouse.down}], [{@code method: Mouse.up}]. */ - void click(int x, int y, ClickOptions options); - default void dblclick(int x, int y) { + void click(double x, double y, ClickOptions options); + default void dblclick(double x, double y) { dblclick(x, y, null); } /** @@ -139,7 +139,7 @@ public interface Mouse { *

* [{@code method: Mouse.up}]. */ - void dblclick(int x, int y, DblclickOptions options); + void dblclick(double x, double y, DblclickOptions options); default void down() { down(null); } @@ -147,13 +147,13 @@ public interface Mouse { * Dispatches a {@code mousedown} event. */ void down(DownOptions options); - default void move(int x, int y) { + default void move(double x, double y) { move(x, y, null); } /** * Dispatches a {@code mousemove} event. */ - void move(int x, int y, MoveOptions options); + void move(double x, double y, MoveOptions options); default void up() { up(null); } diff --git a/playwright/src/main/java/com/microsoft/playwright/Page.java b/playwright/src/main/java/com/microsoft/playwright/Page.java index a6b0a434..54691d74 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Page.java +++ b/playwright/src/main/java/com/microsoft/playwright/Page.java @@ -86,9 +86,9 @@ public interface Page { } class FutureEventOptions { - public Integer timeout; + public Double timeout; public Predicate> predicate; - public FutureEventOptions withTimeout(int millis) { + public FutureEventOptions withTimeout(double millis) { timeout = millis; return this; } @@ -205,15 +205,15 @@ public interface Page { */ public Double timeout; - public CheckOptions withForce(Boolean force) { + public CheckOptions withForce(boolean force) { this.force = force; return this; } - public CheckOptions withNoWaitAfter(Boolean noWaitAfter) { + public CheckOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public CheckOptions withTimeout(Double timeout) { + public CheckOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -261,15 +261,15 @@ public interface Page { this.button = button; return this; } - public ClickOptions withClickCount(Integer clickCount) { + public ClickOptions withClickCount(int clickCount) { this.clickCount = clickCount; return this; } - public ClickOptions withDelay(Double delay) { + public ClickOptions withDelay(double delay) { this.delay = delay; return this; } - public ClickOptions withForce(Boolean force) { + public ClickOptions withForce(boolean force) { this.force = force; return this; } @@ -277,7 +277,7 @@ public interface Page { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public ClickOptions withNoWaitAfter(Boolean noWaitAfter) { + public ClickOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -288,7 +288,7 @@ public interface Page { public ClickOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public ClickOptions withTimeout(Double timeout) { + public ClickOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -300,7 +300,7 @@ public interface Page { */ public Boolean runBeforeUnload; - public CloseOptions withRunBeforeUnload(Boolean runBeforeUnload) { + public CloseOptions withRunBeforeUnload(boolean runBeforeUnload) { this.runBeforeUnload = runBeforeUnload; return this; } @@ -344,11 +344,11 @@ public interface Page { this.button = button; return this; } - public DblclickOptions withDelay(Double delay) { + public DblclickOptions withDelay(double delay) { this.delay = delay; return this; } - public DblclickOptions withForce(Boolean force) { + public DblclickOptions withForce(boolean force) { this.force = force; return this; } @@ -356,7 +356,7 @@ public interface Page { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public DblclickOptions withNoWaitAfter(Boolean noWaitAfter) { + public DblclickOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -367,7 +367,7 @@ public interface Page { public DblclickOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public DblclickOptions withTimeout(Double timeout) { + public DblclickOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -379,7 +379,7 @@ public interface Page { */ public Double timeout; - public DispatchEventOptions withTimeout(Double timeout) { + public DispatchEventOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -414,7 +414,7 @@ public interface Page { */ public Boolean handle; - public ExposeBindingOptions withHandle(Boolean handle) { + public ExposeBindingOptions withHandle(boolean handle) { this.handle = handle; return this; } @@ -432,11 +432,11 @@ public interface Page { */ public Double timeout; - public FillOptions withNoWaitAfter(Boolean noWaitAfter) { + public FillOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public FillOptions withTimeout(Double timeout) { + public FillOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -448,7 +448,7 @@ public interface Page { */ public Double timeout; - public FocusOptions withTimeout(Double timeout) { + public FocusOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -460,7 +460,7 @@ public interface Page { */ public Double timeout; - public GetAttributeOptions withTimeout(Double timeout) { + public GetAttributeOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -481,7 +481,7 @@ public interface Page { */ public Frame.LoadState waitUntil; - public GoBackOptions withTimeout(Double timeout) { + public GoBackOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -506,7 +506,7 @@ public interface Page { */ public Frame.LoadState waitUntil; - public GoForwardOptions withTimeout(Double timeout) { + public GoForwardOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -527,7 +527,7 @@ public interface Page { * [{@code method: BrowserContext.setDefaultTimeout}], [{@code method: Page.setDefaultNavigationTimeout}] or * [{@code method: Page.setDefaultTimeout}] methods. */ - public Integer timeout; + public Double timeout; /** * When to consider operation succeeded, defaults to {@code load}. Events can be either: * - {@code 'domcontentloaded'} - consider operation to be finished when the {@code DOMContentLoaded} event is fired. @@ -540,7 +540,7 @@ public interface Page { this.referer = referer; return this; } - public NavigateOptions withTimeout(Integer timeout) { + public NavigateOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -570,7 +570,7 @@ public interface Page { */ public Double timeout; - public HoverOptions withForce(Boolean force) { + public HoverOptions withForce(boolean force) { this.force = force; return this; } @@ -585,7 +585,7 @@ public interface Page { public HoverOptions withPosition(int x, int y) { return withPosition(new Position(x, y)); } - public HoverOptions withTimeout(Double timeout) { + public HoverOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -597,7 +597,7 @@ public interface Page { */ public Double timeout; - public InnerHTMLOptions withTimeout(Double timeout) { + public InnerHTMLOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -609,7 +609,7 @@ public interface Page { */ public Double timeout; - public InnerTextOptions withTimeout(Double timeout) { + public InnerTextOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -717,7 +717,7 @@ public interface Page { */ public String width; - public PdfOptions withDisplayHeaderFooter(Boolean displayHeaderFooter) { + public PdfOptions withDisplayHeaderFooter(boolean displayHeaderFooter) { this.displayHeaderFooter = displayHeaderFooter; return this; } @@ -737,7 +737,7 @@ public interface Page { this.height = height; return this; } - public PdfOptions withLandscape(Boolean landscape) { + public PdfOptions withLandscape(boolean landscape) { this.landscape = landscape; return this; } @@ -753,15 +753,15 @@ public interface Page { this.path = path; return this; } - public PdfOptions withPreferCSSPageSize(Boolean preferCSSPageSize) { + public PdfOptions withPreferCSSPageSize(boolean preferCSSPageSize) { this.preferCSSPageSize = preferCSSPageSize; return this; } - public PdfOptions withPrintBackground(Boolean printBackground) { + public PdfOptions withPrintBackground(boolean printBackground) { this.printBackground = printBackground; return this; } - public PdfOptions withScale(Double scale) { + public PdfOptions withScale(double scale) { this.scale = scale; return this; } @@ -787,15 +787,15 @@ public interface Page { */ public Double timeout; - public PressOptions withDelay(Double delay) { + public PressOptions withDelay(double delay) { this.delay = delay; return this; } - public PressOptions withNoWaitAfter(Boolean noWaitAfter) { + public PressOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public PressOptions withTimeout(Double timeout) { + public PressOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -816,7 +816,7 @@ public interface Page { */ public Frame.LoadState waitUntil; - public ReloadOptions withTimeout(Double timeout) { + public ReloadOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -906,11 +906,11 @@ public interface Page { this.clip = new Clip(); return this.clip; } - public ScreenshotOptions withFullPage(Boolean fullPage) { + public ScreenshotOptions withFullPage(boolean fullPage) { this.fullPage = fullPage; return this; } - public ScreenshotOptions withOmitBackground(Boolean omitBackground) { + public ScreenshotOptions withOmitBackground(boolean omitBackground) { this.omitBackground = omitBackground; return this; } @@ -918,11 +918,11 @@ public interface Page { this.path = path; return this; } - public ScreenshotOptions withQuality(Integer quality) { + public ScreenshotOptions withQuality(int quality) { this.quality = quality; return this; } - public ScreenshotOptions withTimeout(Double timeout) { + public ScreenshotOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -944,11 +944,11 @@ public interface Page { */ public Double timeout; - public SelectOptionOptions withNoWaitAfter(Boolean noWaitAfter) { + public SelectOptionOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SelectOptionOptions withTimeout(Double timeout) { + public SelectOptionOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -969,7 +969,7 @@ public interface Page { */ public Frame.LoadState waitUntil; - public SetContentOptions withTimeout(Double timeout) { + public SetContentOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -991,11 +991,11 @@ public interface Page { */ public Double timeout; - public SetInputFilesOptions withNoWaitAfter(Boolean noWaitAfter) { + public SetInputFilesOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SetInputFilesOptions withTimeout(Double timeout) { + public SetInputFilesOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1046,7 +1046,7 @@ public interface Page { */ public Double timeout; - public TapOptions withForce(Boolean force) { + public TapOptions withForce(boolean force) { this.force = force; return this; } @@ -1054,7 +1054,7 @@ public interface Page { this.modifiers = new HashSet<>(Arrays.asList(modifiers)); return this; } - public TapOptions withNoWaitAfter(Boolean noWaitAfter) { + public TapOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } @@ -1062,7 +1062,7 @@ public interface Page { this.position = new Position(); return this.position; } - public TapOptions withTimeout(Double timeout) { + public TapOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1074,7 +1074,7 @@ public interface Page { */ public Double timeout; - public TextContentOptions withTimeout(Double timeout) { + public TextContentOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1096,15 +1096,15 @@ public interface Page { */ public Double timeout; - public TypeOptions withDelay(Double delay) { + public TypeOptions withDelay(double delay) { this.delay = delay; return this; } - public TypeOptions withNoWaitAfter(Boolean noWaitAfter) { + public TypeOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TypeOptions withTimeout(Double timeout) { + public TypeOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1126,15 +1126,15 @@ public interface Page { */ public Double timeout; - public UncheckOptions withForce(Boolean force) { + public UncheckOptions withForce(boolean force) { this.force = force; return this; } - public UncheckOptions withNoWaitAfter(Boolean noWaitAfter) { + public UncheckOptions withNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public UncheckOptions withTimeout(Double timeout) { + public UncheckOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1149,7 +1149,7 @@ public interface Page { * maximum time to wait for in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the [{@code method: BrowserContext.setDefaultTimeout}]. */ - public Integer timeout; + public Double timeout; public WaitForFunctionOptions withRequestAnimationFrame() { this.pollingInterval = null; @@ -1159,7 +1159,7 @@ public interface Page { this.pollingInterval = millis; return this; } - public WaitForFunctionOptions withTimeout(Integer timeout) { + public WaitForFunctionOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1171,9 +1171,9 @@ public interface Page { * [{@code method: BrowserContext.setDefaultTimeout}], [{@code method: Page.setDefaultNavigationTimeout}] or * [{@code method: Page.setDefaultTimeout}] methods. */ - public Integer timeout; + public Double timeout; - public WaitForLoadStateOptions withTimeout(Integer timeout) { + public WaitForLoadStateOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1185,7 +1185,7 @@ public interface Page { * [{@code method: BrowserContext.setDefaultTimeout}], [{@code method: Page.setDefaultNavigationTimeout}] or * [{@code method: Page.setDefaultTimeout}] methods. */ - public Integer timeout; + public Double timeout; /** * A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation. */ @@ -1200,7 +1200,7 @@ public interface Page { */ public Frame.LoadState waitUntil; - public FutureNavigationOptions withTimeout(Integer timeout) { + public FutureNavigationOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1226,9 +1226,9 @@ public interface Page { * Maximum wait time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable the timeout. The default value can be * changed by using the [{@code method: Page.setDefaultTimeout}] method. */ - public Integer timeout; + public Double timeout; - public FutureRequestOptions withTimeout(Integer timeout) { + public FutureRequestOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1238,9 +1238,9 @@ public interface Page { * Maximum wait time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable the timeout. The default value can be * changed by using the [{@code method: BrowserContext.setDefaultTimeout}] or [{@code method: Page.setDefaultTimeout}] methods. */ - public Integer timeout; + public Double timeout; - public FutureResponseOptions withTimeout(Integer timeout) { + public FutureResponseOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1267,7 +1267,7 @@ public interface Page { this.state = state; return this; } - public WaitForSelectorOptions withTimeout(Double timeout) { + public WaitForSelectorOptions withTimeout(double timeout) { this.timeout = timeout; return this; } @@ -2068,14 +2068,14 @@ public interface Page { * [{@code method: BrowserContext.setDefaultTimeout}] and [{@code method: BrowserContext.setDefaultNavigationTimeout}]. * @param timeout Maximum navigation time in milliseconds */ - void setDefaultNavigationTimeout(int timeout); + void setDefaultNavigationTimeout(double timeout); /** * This setting will change the default maximum time for all the methods accepting {@code timeout} option. *

* > NOTE [{@code method: Page.setDefaultNavigationTimeout}] takes priority over [{@code method: Page.setDefaultTimeout}]. * @param timeout Maximum time in milliseconds */ - void setDefaultTimeout(int timeout); + void setDefaultTimeout(double timeout); /** * The extra HTTP headers will be sent with every request the page initiates. *

@@ -2364,7 +2364,7 @@ public interface Page { * Shortcut for main frame's [{@code method: Frame.waitForTimeout}]. * @param timeout A timeout to wait for */ - void waitForTimeout(int timeout); + void waitForTimeout(double timeout); /** * This method returns all of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) *

diff --git a/playwright/src/main/java/com/microsoft/playwright/Selectors.java b/playwright/src/main/java/com/microsoft/playwright/Selectors.java index f30a9fee..2ecac394 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Selectors.java +++ b/playwright/src/main/java/com/microsoft/playwright/Selectors.java @@ -33,7 +33,7 @@ public interface Selectors { */ public Boolean contentScript; - public RegisterOptions withContentScript(Boolean contentScript) { + public RegisterOptions withContentScript(boolean contentScript) { this.contentScript = contentScript; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Touchscreen.java b/playwright/src/main/java/com/microsoft/playwright/Touchscreen.java index 747cc8ab..eeeef336 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Touchscreen.java +++ b/playwright/src/main/java/com/microsoft/playwright/Touchscreen.java @@ -27,6 +27,6 @@ public interface Touchscreen { /** * Dispatches a {@code touchstart} and {@code touchend} event with a single touch at the position ({@code x},{@code y}). */ - void tap(int x, int y); + void tap(double x, double y); } diff --git a/playwright/src/main/java/com/microsoft/playwright/WebSocket.java b/playwright/src/main/java/com/microsoft/playwright/WebSocket.java index 2955e763..b4509602 100644 --- a/playwright/src/main/java/com/microsoft/playwright/WebSocket.java +++ b/playwright/src/main/java/com/microsoft/playwright/WebSocket.java @@ -29,9 +29,9 @@ public interface WebSocket { } class FutureEventOptions { - public Integer timeout; + public Double timeout; public Predicate> predicate; - public FutureEventOptions withTimeout(int millis) { + public FutureEventOptions withTimeout(double millis) { timeout = millis; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java index f2db7bc4..7184efc2 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java @@ -229,7 +229,7 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext { } @Override - public void setDefaultNavigationTimeout(int timeout) { + public void setDefaultNavigationTimeout(double timeout) { withLogging("BrowserContext.setDefaultNavigationTimeout", () -> { timeoutSettings.setDefaultNavigationTimeout(timeout); JsonObject params = new JsonObject(); @@ -239,7 +239,7 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext { } @Override - public void setDefaultTimeout(int timeout) { + public void setDefaultTimeout(double timeout) { withLogging("BrowserContext.setDefaultTimeout", () -> { timeoutSettings.setDefaultTimeout(timeout); JsonObject params = new JsonObject(); diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java index ba5e1d9f..3525c8fd 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java @@ -829,11 +829,11 @@ public class FrameImpl extends ChannelOwner implements Frame { } @Override - public void waitForTimeout(int timeout) { + public void waitForTimeout(double timeout) { withLogging("Frame.waitForTimeout", () -> waitForTimeoutImpl(timeout)); } - void waitForTimeoutImpl(int timeout) { + void waitForTimeoutImpl(double timeout) { toDeferred(new WaitableTimeout(timeout) { @Override public Void get() { diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/MouseImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/MouseImpl.java index c89c9963..a6ec3dda 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/MouseImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/MouseImpl.java @@ -32,11 +32,11 @@ class MouseImpl implements Mouse { } @Override - public void click(int x, int y, ClickOptions options) { + public void click(double x, double y, ClickOptions options) { page.withLogging("Mouse.click", () -> clickImpl(x, y, options)); } - private void clickImpl(int x, int y, ClickOptions options) { + private void clickImpl(double x, double y, ClickOptions options) { if (options == null) { options = new ClickOptions(); } @@ -51,11 +51,11 @@ class MouseImpl implements Mouse { } @Override - public void dblclick(int x, int y, DblclickOptions options) { + public void dblclick(double x, double y, DblclickOptions options) { page.withLogging("Mouse.dblclick", () -> dblclickImpl(x, y, options)); } - private void dblclickImpl(int x, int y, DblclickOptions options) { + private void dblclickImpl(double x, double y, DblclickOptions options) { ClickOptions clickOptions; if (options == null) { clickOptions = new ClickOptions(); @@ -80,11 +80,11 @@ class MouseImpl implements Mouse { } @Override - public void move(int x, int y, MoveOptions options) { + public void move(double x, double y, MoveOptions options) { page.withLogging("Mouse.move", () -> moveImpl(x, y, options)); } - private void moveImpl(int x, int y, MoveOptions options) { + private void moveImpl(double x, double y, MoveOptions options) { if (options == null) { options = new MoveOptions(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java index ea74b3cb..830771f0 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java @@ -653,7 +653,7 @@ public class PageImpl extends ChannelOwner implements Page { } @Override - public void setDefaultNavigationTimeout(int timeout) { + public void setDefaultNavigationTimeout(double timeout) { withLogging("Page.setDefaultNavigationTimeout", () -> { timeoutSettings.setDefaultNavigationTimeout(timeout); JsonObject params = new JsonObject(); @@ -663,7 +663,7 @@ public class PageImpl extends ChannelOwner implements Page { } @Override - public void setDefaultTimeout(int timeout) { + public void setDefaultTimeout(double timeout) { withLogging("Page.setDefaultTimeout", () -> { timeoutSettings.setDefaultTimeout(timeout); JsonObject params = new JsonObject(); @@ -796,11 +796,11 @@ public class PageImpl extends ChannelOwner implements Page { return viewport; } - Waitable createWaitableNavigationTimeout(Integer timeout) { + Waitable createWaitableNavigationTimeout(Double timeout) { return new WaitableTimeout<>(timeoutSettings.navigationTimeout(timeout)); } - Waitable createWaitableTimeout(Integer timeout) { + Waitable createWaitableTimeout(Double timeout) { return timeoutSettings.createWaitable(timeout); } @@ -1017,7 +1017,7 @@ public class PageImpl extends ChannelOwner implements Page { } @Override - public void waitForTimeout(int timeout) { + public void waitForTimeout(double timeout) { withLogging("Page.waitForTimeout", () -> mainFrame.waitForTimeoutImpl(timeout)); } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/TimeoutSettings.java b/playwright/src/main/java/com/microsoft/playwright/impl/TimeoutSettings.java index b472c704..8d1a1a84 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/TimeoutSettings.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/TimeoutSettings.java @@ -20,8 +20,8 @@ class TimeoutSettings { private static final int DEFAULT_TIMEOUT_MS = 30_000; private final TimeoutSettings parent; - private Integer defaultTimeout ; - private Integer defaultNavigationTimeout; + private Double defaultTimeout ; + private Double defaultNavigationTimeout; TimeoutSettings() { this(null); @@ -30,15 +30,15 @@ class TimeoutSettings { this.parent = parent; } - void setDefaultTimeout(int timeout) { + void setDefaultTimeout(double timeout) { defaultTimeout = timeout; } - void setDefaultNavigationTimeout(int timeout) { + void setDefaultNavigationTimeout(double timeout) { defaultNavigationTimeout = timeout; } - int timeout(Integer timeout) { + double timeout(Double timeout) { if (timeout != null) { return timeout; } @@ -51,7 +51,7 @@ class TimeoutSettings { return DEFAULT_TIMEOUT_MS; } - int navigationTimeout(Integer timeout) { + double navigationTimeout(Double timeout) { if (timeout != null) { return timeout; } @@ -67,7 +67,7 @@ class TimeoutSettings { return DEFAULT_TIMEOUT_MS; } - Waitable createWaitable(Integer timeout) { + Waitable createWaitable(Double timeout) { if (timeout != null && timeout == 0) { return new WaitableNever<>(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/TouchscreenImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/TouchscreenImpl.java index c841254e..3e428939 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/TouchscreenImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/TouchscreenImpl.java @@ -27,7 +27,7 @@ class TouchscreenImpl implements Touchscreen { } @Override - public void tap(int x, int y) { + public void tap(double x, double y) { page.withLogging("Touchscreen.tap", () -> { JsonObject params = new JsonObject(); params.addProperty("x", x); diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/WaitableTimeout.java b/playwright/src/main/java/com/microsoft/playwright/impl/WaitableTimeout.java index 76558d3a..eab0441e 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/WaitableTimeout.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/WaitableTimeout.java @@ -20,9 +20,9 @@ import com.microsoft.playwright.PlaywrightException; class WaitableTimeout implements Waitable { private final long deadline; - private final int timeout; + private final double timeout; - WaitableTimeout(int millis) { + WaitableTimeout(double millis) { timeout = millis; deadline = System.nanoTime() + (long) millis * 1_000_000; } @@ -34,7 +34,11 @@ class WaitableTimeout implements Waitable { @Override public T get() { - throw new PlaywrightException("Timeout " + timeout + "ms exceeded"); + String timeoutStr = Double.toString(timeout); + if (timeoutStr.endsWith(".0")) { + timeoutStr = timeoutStr.substring(0, timeoutStr.length() - 2); + } + throw new PlaywrightException("Timeout " + timeoutStr + "ms exceeded"); } @Override diff --git a/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java index ee6e01ca..d255a5a1 100644 --- a/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java +++ b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java @@ -24,7 +24,6 @@ import com.google.gson.JsonObject; import java.io.*; import java.nio.file.FileSystems; import java.util.*; -import java.util.stream.Collectors; import static java.util.Arrays.asList; @@ -843,7 +842,15 @@ class Field extends Element { output.add(offset + " this." + name + " = new HashSet<>(Arrays.asList(modifiers));"); output.add(offset + " return this;"); } else { - output.add(offset + "public " + parentClass + " with" + toTitle(name) + "(" + type.toJava() + " " + name + ") {"); + String paramType = type.toJava(); + if ("Boolean".equals(paramType)) { + paramType = "boolean"; + } else if ("Integer".equals(paramType)) { + paramType = "int"; + } else if ("Double".equals(paramType)) { + paramType = "double"; + } + output.add(offset + "public " + parentClass + " with" + toTitle(name) + "(" + paramType + " " + name + ") {"); output.add(offset + " this." + name + " = " + name + ";"); output.add(offset + " return this;"); } @@ -1168,10 +1175,10 @@ class Interface extends TypeDefinition { } if (asList("Page", "BrowserContext", "WebSocket").contains(jsonName)){ output.add(offset + "class FutureEventOptions {"); - output.add(offset + " public Integer timeout;"); + output.add(offset + " public Double timeout;"); output.add(offset + " public Predicate> predicate;"); - output.add(offset + " public FutureEventOptions withTimeout(int millis) {"); + output.add(offset + " public FutureEventOptions withTimeout(double millis) {"); output.add(offset + " timeout = millis;"); output.add(offset + " return this;"); output.add(offset + " }"); diff --git a/tools/api-generator/src/main/java/com/microsoft/playwright/tools/Types.java b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/Types.java index 8e9daa1f..28f9a6b9 100644 --- a/tools/api-generator/src/main/java/com/microsoft/playwright/tools/Types.java +++ b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/Types.java @@ -371,32 +371,6 @@ class Types { add("BrowserContext.setExtraHTTPHeaders.headers", "Object", "Map", new Empty()); add("Route.continue.overrides.headers", "Object", "Map", new Empty()); add("Route.fulfill.response.headers", "Object", "Map", new Empty()); - - add("BrowserContext.setDefaultTimeout.timeout", "float", "int", new Empty()); - add("BrowserContext.setDefaultNavigationTimeout.timeout", "float", "int", new Empty()); - add("Page.waitForRequest.options.timeout", "float", "Integer", new Empty()); - add("Page.waitForResponse.options.timeout", "float", "Integer", new Empty()); - add("Page.waitForTimeout.timeout", "float", "int", new Empty()); - add("Frame.waitForTimeout.timeout", "float", "int", new Empty()); - add("Page.goto.options.timeout", "float", "Integer", new Empty()); - add("Frame.goto.options.timeout", "float", "Integer", new Empty()); - add("Page.setDefaultTimeout.timeout", "float", "int", new Empty()); - add("Page.setDefaultNavigationTimeout.timeout", "float", "int", new Empty()); - add("Frame.waitForLoadState.options.timeout", "float", "Integer", new Empty()); - add("Page.waitForLoadState.options.timeout", "float", "Integer", new Empty()); - add("Frame.waitForNavigation.options.timeout", "float", "Integer", new Empty()); - add("Page.waitForNavigation.options.timeout", "float", "Integer", new Empty()); - add("ElementHandle.waitForElementState.options.timeout", "float", "Integer", new Empty()); - add("Page.waitForFunction.options.timeout", "float", "Integer", new Empty()); - add("Mouse.click.x", "float", "int", new Empty()); - add("Mouse.click.y", "float", "int", new Empty()); - add("Mouse.dblclick.x", "float", "int", new Empty()); - add("Mouse.dblclick.y", "float", "int", new Empty()); - add("Mouse.move.x", "float", "int", new Empty()); - add("Mouse.move.y", "float", "int", new Empty()); - add("Touchscreen.tap.x", "float", "int", new Empty()); - add("Touchscreen.tap.y", "float", "int", new Empty()); - add("Playwright.devices", "Object", "Map", new Empty()); // JSON type