From 5b90067ffcdcc110a1d4d566f18bd3366c520cbd Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 23 Dec 2020 11:23:27 -0800 Subject: [PATCH] chore: roll to playwright-cli@0.180.0-next.1608746109749-cbc13bd (#172) --- README.md | 2 +- .../microsoft/playwright/Accessibility.java | 28 +- .../com/microsoft/playwright/Browser.java | 41 +- .../microsoft/playwright/BrowserContext.java | 98 ++-- .../com/microsoft/playwright/BrowserType.java | 40 +- .../microsoft/playwright/ConsoleMessage.java | 6 +- .../com/microsoft/playwright/Download.java | 18 +- .../microsoft/playwright/ElementHandle.java | 196 +++----- .../com/microsoft/playwright/FileChooser.java | 8 +- .../java/com/microsoft/playwright/Frame.java | 280 ++++------- .../com/microsoft/playwright/JSHandle.java | 36 +- .../com/microsoft/playwright/Keyboard.java | 54 +-- .../java/com/microsoft/playwright/Mouse.java | 4 +- .../java/com/microsoft/playwright/Page.java | 438 ++++++------------ .../com/microsoft/playwright/Request.java | 32 +- .../java/com/microsoft/playwright/Route.java | 6 +- .../com/microsoft/playwright/Selectors.java | 4 +- .../microsoft/playwright/TimeoutError.java | 4 +- .../com/microsoft/playwright/Touchscreen.java | 4 +- .../java/com/microsoft/playwright/Video.java | 4 +- .../com/microsoft/playwright/WebSocket.java | 4 +- .../java/com/microsoft/playwright/Worker.java | 24 +- .../microsoft/playwright/impl/FrameImpl.java | 40 +- .../microsoft/playwright/impl/PageImpl.java | 8 +- scripts/CLI_VERSION | 2 +- .../com/microsoft/playwright/tools/Types.java | 8 +- 26 files changed, 426 insertions(+), 963 deletions(-) diff --git a/README.md b/README.md index f43c67b6..ad46f46c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom | :--- | :---: | :---: | :---: | | Chromium 89.0.4344.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 14.1 | ✅ | ✅ | ✅ | -| Firefox 84.0b9 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Firefox 85.0b1 | :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/#?path=docs/intro.md&q=system-requirements) for details. diff --git a/playwright/src/main/java/com/microsoft/playwright/Accessibility.java b/playwright/src/main/java/com/microsoft/playwright/Accessibility.java index d3ecacc0..a4be4990 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Accessibility.java +++ b/playwright/src/main/java/com/microsoft/playwright/Accessibility.java @@ -19,25 +19,13 @@ package com.microsoft.playwright; import java.util.*; /** - * The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by + * The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as screen readers or switches. *

- * assistive technology such as screen readers or + * Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output. *

- * switches. + * Blink - Chromium's rendering engine - has a concept of "accessibility tree", which is then translated into different platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree. *

- * Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might - *

- * have wildly different output. - *

- * Blink - Chromium's rendering engine - has a concept of "accessibility tree", which is then translated into different - *

- * platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree. - *

- * Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by - *

- * assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing only the - *

- * "interesting" nodes of the tree. + * Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by assistive technologies themselves. By default, Playwright tries to approximate this filtering, exposing only the "interesting" nodes of the tree. */ public interface Accessibility { class SnapshotOptions { @@ -63,13 +51,9 @@ public interface Accessibility { return snapshot(null); } /** - * Captures the current state of the accessibility tree. The returned object represents the root accessible node of the + * Captures the current state of the accessibility tree. The returned object represents the root accessible node of the page. *

- * page. - *

- * NOTE The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. - *

- * Playwright will discard them as well for an easier to process tree, unless {@code interestingOnly} is set to {@code false}. + * NOTE The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers. Playwright will discard them as well for an easier to process tree, unless {@code interestingOnly} is set to {@code false}. *

*/ AccessibilityNode snapshot(SnapshotOptions options); diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java index e9e1023b..f989132d 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Browser.java +++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java @@ -20,13 +20,8 @@ import java.nio.file.Path; import java.util.*; /** - * A Browser is created when Playwright connects to a browser instance, either through browserType.launch([options]) or + * A Browser is created when Playwright connects to a browser instance, either through {@code browserType.launch([options])} or {@code browserType.connect(params)}. *

- * browserType.connect(params). - *

- * browserType.connect(params) and browserType.launch([options]) always return a specific browser instance, based on the browser - *

- * being connected to or launched. */ public interface Browser { class VideoSize { @@ -191,7 +186,7 @@ public interface Browser { */ public String locale; /** - * A list of permissions to grant to all pages in this context. See browserContext.grantPermissions(permissions[, options]) for more details. + * A list of permissions to grant to all pages in this context. See {@code browserContext.grantPermissions(permissions[, options])} for more details. */ public List permissions; /** @@ -207,7 +202,7 @@ public interface Browser { */ public BrowserContext.HTTPCredentials httpCredentials; /** - * Emulates {@code 'prefers-colors-scheme'} media feature, supported values are {@code 'light'}, {@code 'dark'}, {@code 'no-preference'}. See page.emulateMedia(params) for more details. Defaults to '{@code light}'. + * Emulates {@code 'prefers-colors-scheme'} media feature, supported values are {@code 'light'}, {@code 'dark'}, {@code 'no-preference'}. See {@code page.emulateMedia(params)} for more details. Defaults to '{@code light}'. */ public ColorScheme colorScheme; /** @@ -215,11 +210,11 @@ public interface Browser { */ public Logger logger; /** - * Enables HAR recording for all pages into {@code recordHar.path} file. If not specified, the HAR is not recorded. Make sure to await browserContext.close() for the HAR to be saved. + * Enables HAR recording for all pages into {@code recordHar.path} file. If not specified, the HAR is not recorded. Make sure to await {@code browserContext.close()} for the HAR to be saved. */ public RecordHar recordHar; /** - * Enables video recording for all pages into {@code recordVideo.dir} directory. If not specified videos are not recorded. Make sure to await browserContext.close() for videos to be saved. + * Enables video recording for all pages into {@code recordVideo.dir} directory. If not specified videos are not recorded. Make sure to await {@code browserContext.close()} for videos to be saved. */ public RecordVideo recordVideo; /** @@ -227,7 +222,7 @@ public interface Browser { */ public Proxy proxy; /** - * Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via browserContext.storageState([options]). Either a path to the file with saved storage, or an object with the following fields: + * Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via {@code browserContext.storageState([options])}. Either a path to the file with saved storage, or an object with the following fields: */ public BrowserContext.StorageState storageState; public Path storageStatePath; @@ -473,7 +468,7 @@ public interface Browser { */ public String locale; /** - * A list of permissions to grant to all pages in this context. See browserContext.grantPermissions(permissions[, options]) for more details. + * A list of permissions to grant to all pages in this context. See {@code browserContext.grantPermissions(permissions[, options])} for more details. */ public List permissions; /** @@ -489,7 +484,7 @@ public interface Browser { */ public BrowserContext.HTTPCredentials httpCredentials; /** - * Emulates {@code 'prefers-colors-scheme'} media feature, supported values are {@code 'light'}, {@code 'dark'}, {@code 'no-preference'}. See page.emulateMedia(params) for more details. Defaults to '{@code light}'. + * Emulates {@code 'prefers-colors-scheme'} media feature, supported values are {@code 'light'}, {@code 'dark'}, {@code 'no-preference'}. See {@code page.emulateMedia(params)} for more details. Defaults to '{@code light}'. */ public ColorScheme colorScheme; /** @@ -497,11 +492,11 @@ public interface Browser { */ public Logger logger; /** - * Enables HAR recording for all pages into {@code recordHar.path} file. If not specified, the HAR is not recorded. Make sure to await browserContext.close() for the HAR to be saved. + * Enables HAR recording for all pages into {@code recordHar.path} file. If not specified, the HAR is not recorded. Make sure to await {@code browserContext.close()} for the HAR to be saved. */ public RecordHar recordHar; /** - * Enables video recording for all pages into {@code recordVideo.dir} directory. If not specified videos are not recorded. Make sure to await browserContext.close() for videos to be saved. + * Enables video recording for all pages into {@code recordVideo.dir} directory. If not specified videos are not recorded. Make sure to await {@code browserContext.close()} for videos to be saved. */ public RecordVideo recordVideo; /** @@ -509,7 +504,7 @@ public interface Browser { */ public Proxy proxy; /** - * Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via browserContext.storageState([options]). Either a path to the file with saved storage, or an object with the following fields: + * Populates context with given storage state. This method can be used to initialize context with logged-in information obtained via {@code browserContext.storageState([options])}. Either a path to the file with saved storage, or an object with the following fields: */ public BrowserContext.StorageState storageState; public Path storageStatePath; @@ -618,13 +613,9 @@ public interface Browser { } } /** - * In case this browser is obtained using browserType.launch([options]), closes the browser and all of its pages (if any were + * In case this browser is obtained using {@code browserType.launch([options])}, closes the browser and all of its pages (if any were opened). *

- * opened). - *

- * In case this browser is obtained using browserType.connect(params), clears all created contexts belonging to this browser - *

- * and disconnects from the browser server. + * In case this browser is obtained using {@code browserType.connect(params)}, clears all created contexts belonging to this browser and disconnects from the browser server. *

* The Browser object itself is considered to be disposed and cannot be used anymore. */ @@ -652,11 +643,7 @@ public interface Browser { /** * Creates a new page in a new browser context. Closing this page will close the context as well. *

- * This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and - *

- * testing frameworks should explicitly create browser.newContext([options]) followed by the browserContext.newPage() to - *

- * control their exact life times. + * This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and testing frameworks should explicitly create {@code browser.newContext([options])} followed by the {@code browserContext.newPage()} to control their exact life times. */ Page newPage(NewPageOptions options); /** diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java index aa2bf376..b4c516de 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java @@ -25,13 +25,9 @@ import java.util.regex.Pattern; /** * BrowserContexts provide a way to operate multiple independent browser sessions. *

- * If a page opens another page, e.g. with a {@code window.open} call, the popup will belong to the parent page's browser + * If a page opens another page, e.g. with a {@code window.open} call, the popup will belong to the parent page's browser context. *

- * context. - *

- * Playwright allows creation of "incognito" browser contexts with {@code browser.newContext()} method. "Incognito" browser - *

- * contexts don't write any browsing data to disk. + * Playwright allows creation of "incognito" browser contexts with {@code browser.newContext()} method. "Incognito" browser contexts don't write any browsing data to disk. *

*/ public interface BrowserContext { @@ -253,9 +249,7 @@ public interface BrowserContext { } } /** - * Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be - *

- * obtained via browserContext.cookies([urls]). + * Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be obtained via {@code browserContext.cookies([urls])}. *

*/ void addCookies(List cookies); @@ -269,15 +263,11 @@ public interface BrowserContext { *

* Whenever a child frame is attached or navigated in any page in the browser context. In this case, the script is evaluated in the context of the newly attached frame. *

- * The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend - *

- * the JavaScript environment, e.g. to seed {@code Math.random}. + * The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend the JavaScript environment, e.g. to seed {@code Math.random}. *

* *

- * NOTE The order of evaluation of multiple scripts installed via browserContext.addInitScript(script[, arg]) and - *

- * page.addInitScript(script[, arg]) is not defined. + * NOTE The order of evaluation of multiple scripts installed via {@code browserContext.addInitScript(script[, arg])} and {@code page.addInitScript(script[, arg])} is not defined. * @param script Script to be evaluated in all pages in the browser context. * @param arg Optional argument to pass to {@code script} (only supported when passing a function). */ @@ -304,9 +294,7 @@ public interface BrowserContext { default List cookies() { return cookies((List) null); } default List cookies(String url) { return cookies(Arrays.asList(url)); } /** - * If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs - *

- * are returned. + * If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs are returned. * @param urls Optional list of URLs. */ List cookies(List urls); @@ -314,29 +302,21 @@ public interface BrowserContext { exposeBinding(name, playwrightBinding, null); } /** - * The method adds a function called {@code name} on the {@code window} object of every frame in every page in the context. When - *

- * called, the function executes {@code playwrightBinding} in Node.js and returns a Promise which resolves to the return value - *

- * of {@code playwrightBinding}. If the {@code playwrightBinding} returns a Promise, it will be awaited. + * The method adds a function called {@code name} on the {@code window} object of every frame in every page in the context. When called, the function executes {@code playwrightBinding} and returns a Promise which resolves to the return value of {@code playwrightBinding}. If the {@code playwrightBinding} returns a Promise, it will be awaited. *

* The first argument of the {@code playwrightBinding} function contains information about the caller: {@code { browserContext: BrowserContext, page: Page, frame: Frame }}. *

- * See page.exposeBinding(name, playwrightBinding[, options]) for page-only version. + * See {@code page.exposeBinding(name, playwrightBinding[, options])} for page-only version. * @param name Name of the function on the window object. * @param playwrightBinding Callback function that will be called in the Playwright's context. */ void exposeBinding(String name, Page.Binding playwrightBinding, ExposeBindingOptions options); /** - * The method adds a function called {@code name} on the {@code window} object of every frame in every page in the context. When - *

- * called, the function executes {@code playwrightFunction} in Node.js and returns a Promise which resolves to the return value - *

- * of {@code playwrightFunction}. + * The method adds a function called {@code name} on the {@code window} object of every frame in every page in the context. When called, the function executes {@code playwrightFunction} and returns a Promise which resolves to the return value of {@code playwrightFunction}. *

* If the {@code playwrightFunction} returns a Promise, it will be awaited. *

- * See page.exposeFunction(name, playwrightFunction) for page-only version. + * See {@code page.exposeFunction(name, playwrightFunction)} for page-only version. * @param name Name of the function on the window object. * @param playwrightFunction Callback function that will be called in the Playwright's context. */ @@ -345,9 +325,7 @@ public interface BrowserContext { grantPermissions(permissions, null); } /** - * Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if - *

- * specified. + * Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if specified. * @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values: * - {@code 'geolocation'} * - {@code 'midi'} @@ -372,23 +350,17 @@ public interface BrowserContext { */ Page newPage(); /** - * Returns all open pages in the context. Non visible pages, such as {@code "background_page"}, will not be listed here. You can - *

- * find them using chromiumBrowserContext.backgroundPages(). + * Returns all open pages in the context. Non visible pages, such as {@code "background_page"}, will not be listed here. You can find them using {@code chromiumBrowserContext.backgroundPages()}. */ List pages(); void route(String url, Consumer handler); void route(Pattern url, Consumer handler); /** - * Routing provides the capability to modify network requests that are made by any page in the browser context. Once route - *

- * is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted. + * Routing provides the capability to modify network requests that are made by any page in the browser context. Once route is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted. *

* or the same snippet using a regex pattern instead: *

- * Page routes (set up with page.route(url, handler)) take precedence over browser context routes when request matches both - *

- * handlers. + * Page routes (set up with {@code page.route(url, handler)}) take precedence over browser context routes when request matches both handlers. *

* NOTE Enabling routing disables http cache. * @param url A glob pattern, regex pattern or predicate receiving URL to match while routing. @@ -398,41 +370,33 @@ public interface BrowserContext { /** * This setting will change the default maximum navigation time for the following methods and related shortcuts: *

- * page.goBack([options]) + * {@code page.goBack([options])} *

- * page.goForward([options]) + * {@code page.goForward([options])} *

- * page.goto(url[, options]) + * {@code page.goto(url[, options])} *

- * page.reload([options]) + * {@code page.reload([options])} *

- * page.setContent(html[, options]) + * {@code page.setContent(html[, options])} *

- * page.waitForNavigation([options]) + * {@code page.waitForNavigation([options])} *

* *

- * NOTE page.setDefaultNavigationTimeout(timeout) and page.setDefaultTimeout(timeout) take priority over - *

- * browserContext.setDefaultNavigationTimeout(timeout). + * NOTE {@code page.setDefaultNavigationTimeout(timeout)} and {@code page.setDefaultTimeout(timeout)} take priority over {@code browserContext.setDefaultNavigationTimeout(timeout)}. * @param timeout Maximum navigation time in milliseconds */ void setDefaultNavigationTimeout(int timeout); /** * This setting will change the default maximum time for all the methods accepting {@code timeout} option. *

- * NOTE page.setDefaultNavigationTimeout(timeout), page.setDefaultTimeout(timeout) and - *

- * browserContext.setDefaultNavigationTimeout(timeout) take priority over browserContext.setDefaultTimeout(timeout). + * NOTE {@code page.setDefaultNavigationTimeout(timeout)}, {@code page.setDefaultTimeout(timeout)} and {@code browserContext.setDefaultNavigationTimeout(timeout)} take priority over {@code browserContext.setDefaultTimeout(timeout)}. * @param timeout Maximum time in milliseconds */ void setDefaultTimeout(int timeout); /** - * The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are merged - *

- * with page-specific extra HTTP headers set with page.setExtraHTTPHeaders(headers). If page overrides a particular header, - *

- * page-specific header value will be used instead of the browser context header value. + * The extra HTTP headers will be sent with every request initiated by any page in the context. These headers are merged with page-specific extra HTTP headers set with {@code page.setExtraHTTPHeaders(headers)}. If page overrides a particular header, page-specific header value will be used instead of the browser context header value. *

* NOTE {@code browserContext.setExtraHTTPHeaders} does not guarantee the order of headers in the outgoing requests. * @param headers An object containing additional HTTP headers to be sent with every request. All header values must be strings. @@ -443,9 +407,7 @@ public interface BrowserContext { *

* *

- * NOTE Consider using browserContext.grantPermissions(permissions[, options]) to grant permissions for the browser context pages to - *

- * read its geolocation. + * NOTE Consider using {@code browserContext.grantPermissions(permissions[, options])} to grant permissions for the browser context pages to read its geolocation. */ void setGeolocation(Geolocation geolocation); /** @@ -466,11 +428,9 @@ public interface BrowserContext { void unroute(String url, Consumer handler); void unroute(Pattern url, Consumer handler); /** - * Removes a route created with browserContext.route(url, handler). When {@code handler} is not specified, removes all routes for the - *

- * {@code url}. - * @param url A glob pattern, regex pattern or predicate receiving URL used to register a routing with browserContext.route(url, handler). - * @param handler Optional handler function used to register a routing with browserContext.route(url, handler). + * Removes a route created with {@code browserContext.route(url, handler)}. When {@code handler} is not specified, removes all routes for the {@code url}. + * @param url A glob pattern, regex pattern or predicate receiving URL used to register a routing with {@code browserContext.route(url, handler)}. + * @param handler Optional handler function used to register a routing with {@code browserContext.route(url, handler)}. */ void unroute(Predicate url, Consumer handler); default Deferred> waitForEvent(EventType event) { @@ -482,9 +442,7 @@ public interface BrowserContext { return waitForEvent(event, options); } /** - * Waits for event to fire and passes its value into the predicate function. Resolves when the predicate returns truthy - *

- * value. Will throw an error if the context closes before the event is fired. Returns the event data value. + * Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value. Will throw an error if the context closes before the event is fired. Returns the event data value. *

* * @param event Event name, same one would pass into {@code browserContext.on(event)}. diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index e38fa8ae..f4daa5a6 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -20,9 +20,7 @@ import java.nio.file.Path; import java.util.*; /** - * BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a - *

- * typical example of using Playwright to drive automation: + * BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a typical example of using Playwright to drive automation: *

*/ public interface BrowserType { @@ -73,7 +71,7 @@ public interface BrowserType { */ public Boolean headless; /** - * Path to a browser executable to run instead of the bundled one. If {@code executablePath} is a relative path, then it is resolved relative to current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk. + * Path to a browser executable to run instead of the bundled one. If {@code executablePath} is a relative path, then it is resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox or WebKit, use at your own risk. */ public Path executablePath; /** @@ -320,7 +318,7 @@ public interface BrowserType { */ public Boolean headless; /** - * Path to a browser executable to run instead of the bundled one. If {@code executablePath} is a relative path, then it is resolved relative to current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk. + * Path to a browser executable to run instead of the bundled one. If {@code executablePath} is a relative path, then it is resolved relative to the current working directory. **BEWARE**: Playwright is only guaranteed to work with the bundled Chromium, Firefox or WebKit, use at your own risk. */ public Path executablePath; /** @@ -417,7 +415,7 @@ public interface BrowserType { */ public String locale; /** - * A list of permissions to grant to all pages in this context. See browserContext.grantPermissions(permissions[, options]) for more details. + * A list of permissions to grant to all pages in this context. See {@code browserContext.grantPermissions(permissions[, options])} for more details. */ public List permissions; /** @@ -433,7 +431,7 @@ public interface BrowserType { */ public BrowserContext.HTTPCredentials httpCredentials; /** - * Emulates {@code 'prefers-colors-scheme'} media feature, supported values are {@code 'light'}, {@code 'dark'}, {@code 'no-preference'}. See page.emulateMedia(params) for more details. Defaults to '{@code light}'. + * Emulates {@code 'prefers-colors-scheme'} media feature, supported values are {@code 'light'}, {@code 'dark'}, {@code 'no-preference'}. See {@code page.emulateMedia(params)} for more details. Defaults to '{@code light}'. */ public ColorScheme colorScheme; /** @@ -441,11 +439,11 @@ public interface BrowserType { */ public Logger logger; /** - * Enables HAR recording for all pages into {@code recordHar.path} file. If not specified, the HAR is not recorded. Make sure to await browserContext.close() for the HAR to be saved. + * Enables HAR recording for all pages into {@code recordHar.path} file. If not specified, the HAR is not recorded. Make sure to await {@code browserContext.close()} for the HAR to be saved. */ public RecordHar recordHar; /** - * Enables video recording for all pages into {@code recordVideo.dir} directory. If not specified videos are not recorded. Make sure to await browserContext.close() for videos to be saved. + * Enables video recording for all pages into {@code recordVideo.dir} directory. If not specified videos are not recorded. Make sure to await {@code browserContext.close()} for videos to be saved. */ public RecordVideo recordVideo; @@ -600,25 +598,13 @@ public interface BrowserType { *

* *

- * **Chromium-only** Playwright can also be used to control the Chrome browser, but it works best with the version of + * **Chromium-only** Playwright can also be used to control the Chrome browser, but it works best with the version of Chromium it is bundled with. There is no guarantee it will work with any other version. Use {@code executablePath} option with extreme caution. *

- * Chromium it is bundled with. There is no guarantee it will work with any other version. Use {@code executablePath} option with + * If Google Chrome (rather than Chromium) is preferred, a Chrome Canary or Dev Channel build is suggested. *

- * extreme caution. + * In {@code browserType.launch([options])} above, any mention of Chromium also applies to Chrome. *

- * If Google Chrome (rather than Chromium) is preferred, a Chrome - *

- * Canary or Dev - *

- * Channel build is suggested. - *

- * In browserType.launch([options]) above, any mention of Chromium also applies to Chrome. - *

- * See {@code this article} for - *

- * a description of the differences between Chromium and Chrome. {@code This article} describes - *

- * some differences for Linux users. + * See {@code this article} for a description of the differences between Chromium and Chrome. {@code This article} describes some differences for Linux users. */ Browser launch(LaunchOptions options); default BrowserContext launchPersistentContext(Path userDataDir) { @@ -627,9 +613,7 @@ public interface BrowserType { /** * Returns the persistent browser context instance. *

- * Launches browser that uses persistent storage located at {@code userDataDir} and returns the only context. Closing this - *

- * context will automatically close the browser. + * Launches browser that uses persistent storage located at {@code userDataDir} and returns the only context. Closing this context will automatically close the browser. * @param userDataDir Path to a User Data Directory, which stores browser session data like cookies and local storage. More details for Chromium and Firefox. */ BrowserContext launchPersistentContext(Path userDataDir, LaunchPersistentContextOptions options); diff --git a/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java b/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java index de0c338d..8650be0a 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java +++ b/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java @@ -50,11 +50,7 @@ public interface ConsoleMessage { Location location(); String text(); /** - * One of the following values: {@code 'log'}, {@code 'debug'}, {@code 'info'}, {@code 'error'}, {@code 'warning'}, {@code 'dir'}, {@code 'dirxml'}, {@code 'table'}, - *

- * {@code 'trace'}, {@code 'clear'}, {@code 'startGroup'}, {@code 'startGroupCollapsed'}, {@code 'endGroup'}, {@code 'assert'}, {@code 'profile'}, {@code 'profileEnd'}, - *

- * {@code 'count'}, {@code 'timeEnd'}. + * One of the following values: {@code 'log'}, {@code 'debug'}, {@code 'info'}, {@code 'error'}, {@code 'warning'}, {@code 'dir'}, {@code 'dirxml'}, {@code 'table'}, {@code 'trace'}, {@code 'clear'}, {@code 'startGroup'}, {@code 'startGroupCollapsed'}, {@code 'endGroup'}, {@code 'assert'}, {@code 'profile'}, {@code 'profileEnd'}, {@code 'count'}, {@code 'timeEnd'}. */ String type(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/Download.java b/playwright/src/main/java/com/microsoft/playwright/Download.java index 63441f7f..4d80a51c 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Download.java +++ b/playwright/src/main/java/com/microsoft/playwright/Download.java @@ -23,19 +23,13 @@ import java.util.*; /** * Download objects are dispatched by page via the page.on('download') event. *

- * All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded - *

- * files are deleted when the browser closes. + * All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded files are deleted when the browser closes. *

* Download event is emitted once the download starts. Download path becomes available once download completes: *

* *

- * NOTE Browser context **must** be created with the {@code acceptDownloads} set to {@code true} when user needs access to the - *

- * downloaded content. If {@code acceptDownloads} is not set or set to {@code false}, download events are emitted, but the actual - *

- * download is not performed and user has no access to the downloaded files. + * NOTE Browser context **must** be created with the {@code acceptDownloads} set to {@code true} when user needs access to the downloaded content. If {@code acceptDownloads} is not set or set to {@code false}, download events are emitted, but the actual download is not performed and user has no access to the downloaded files. */ public interface Download { /** @@ -60,13 +54,7 @@ public interface Download { */ void saveAs(Path path); /** - * Returns suggested filename for this download. It is typically computed by the browser from the - *

- * {@code Content-Disposition} response header - *

- * or the {@code download} attribute. See the spec on whatwg. Different - *

- * browsers can use different logic for computing it. + * Returns suggested filename for this download. It is typically computed by the browser from the {@code Content-Disposition} response header or the {@code download} attribute. See the spec on whatwg. Different browsers can use different logic for computing it. */ String suggestedFilename(); /** diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java index 3595dc55..7e413929 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -20,13 +20,11 @@ import java.nio.file.Path; import java.util.*; /** - * ElementHandle represents an in-page DOM element. ElementHandles can be created with the page.$(selector) method. + * ElementHandle represents an in-page DOM element. ElementHandles can be created with the {@code page.$(selector)} method. *

- * ElementHandle prevents DOM element from garbage collection unless the handle is disposed with jsHandle.dispose(). + * ElementHandle prevents DOM element from garbage collection unless the handle is disposed with {@code jsHandle.dispose()}. ElementHandles are auto-disposed when their origin frame gets navigated. *

- * ElementHandles are auto-disposed when their origin frame gets navigated. - *

- * ElementHandle instances can be used as an argument in page.$eval(selector, pageFunction[, arg]) and page.evaluate(pageFunction[, arg]) methods. + * ElementHandle instances can be used as an argument in {@code page.$eval(selector, pageFunction[, arg])} and {@code page.evaluate(pageFunction[, arg])} methods. */ public interface ElementHandle extends JSHandle { class BoundingBox { @@ -66,7 +64,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -113,7 +111,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -179,7 +177,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -221,7 +219,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -248,7 +246,7 @@ public interface ElementHandle extends JSHandle { */ public Boolean force; /** - * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -282,7 +280,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -302,7 +300,7 @@ public interface ElementHandle extends JSHandle { class ScreenshotOptions { public enum Type { JPEG, PNG } /** - * The file path to save the image to. The screenshot type will be inferred from file extension. If {@code path} is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk. + * The file path to save the image to. The screenshot type will be inferred from file extension. If {@code path} is a relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to the disk. */ public Path path; /** @@ -318,7 +316,7 @@ public interface ElementHandle extends JSHandle { */ public Boolean omitBackground; /** - * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -345,7 +343,7 @@ public interface ElementHandle extends JSHandle { } class ScrollIntoViewIfNeededOptions { /** - * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -360,7 +358,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -375,7 +373,7 @@ public interface ElementHandle extends JSHandle { } class SelectTextOptions { /** - * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -390,7 +388,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -440,7 +438,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -475,7 +473,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -502,7 +500,7 @@ public interface ElementHandle extends JSHandle { */ 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 browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -521,7 +519,7 @@ public interface ElementHandle extends JSHandle { } class WaitForElementStateOptions { /** - * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -541,7 +539,7 @@ public interface ElementHandle extends JSHandle { */ public State state; /** - * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods. + * Maximum time in milliseconds, defaults to 30 seconds, pass {@code 0} to disable timeout. The default value can be changed by using the {@code browserContext.setDefaultTimeout(timeout)} or {@code page.setDefaultTimeout(timeout)} methods. */ public Integer timeout; @@ -555,20 +553,12 @@ public interface ElementHandle extends JSHandle { } } /** - * The method finds an element matching the specified selector in the {@code ElementHandle}'s subtree. See Working with - *

- * selectors for more details. If no elements match the selector, the return value resolves to - *

- * {@code null}. + * The method finds an element matching the specified selector in the {@code ElementHandle}'s subtree. See Working with selectors for more details. If no elements match the selector, returns {@code null}. * @param selector A selector to query for. See working with selectors for more details. */ ElementHandle querySelector(String selector); /** - * The method finds all elements matching the specified selector in the {@code ElementHandle}s subtree. See Working with - *

- * selectors for more details. If no elements match the selector, the return value resolves to - *

- * {@code []}. + * The method finds all elements matching the specified selector in the {@code ElementHandle}s subtree. See Working with selectors for more details. If no elements match the selector, returns empty array. * @param selector A selector to query for. See working with selectors for more details. */ List querySelectorAll(String selector); @@ -578,11 +568,7 @@ public interface ElementHandle extends JSHandle { /** * Returns the return value of {@code pageFunction} *

- * The method finds an element matching the specified selector in the {@code ElementHandle}s subtree and passes it as a first - *

- * argument to {@code pageFunction}. See Working with selectors for more details. If no elements match - *

- * the selector, the method throws an error. + * The method finds an element matching the specified selector in the {@code ElementHandle}s subtree and passes it as a first argument to {@code pageFunction}. See Working with selectors for more details. If no elements match the selector, the method throws an error. *

* If {@code pageFunction} returns a Promise, then {@code frame.$eval} would wait for the promise to resolve and return its value. *

@@ -600,11 +586,7 @@ public interface ElementHandle extends JSHandle { /** * Returns the return value of {@code pageFunction} *

- * The method finds all elements matching the specified selector in the {@code ElementHandle}'s subtree and passes an array of - *

- * matched elements as a first argument to {@code pageFunction}. See Working with selectors for more - *

- * details. + * The method finds all elements matching the specified selector in the {@code ElementHandle}'s subtree and passes an array of matched elements as a first argument to {@code pageFunction}. See Working with selectors for more details. *

* If {@code pageFunction} returns a Promise, then {@code frame.$$eval} would wait for the promise to resolve and return its value. *

@@ -617,23 +599,13 @@ public interface ElementHandle extends JSHandle { */ Object evalOnSelectorAll(String selector, String pageFunction, Object arg); /** - * This method returns the bounding box of the element, or {@code null} if the element is not visible. The bounding box is + * This method returns the bounding box of the element, or {@code null} if the element is not visible. The bounding box is calculated relative to the main frame viewport - which is usually the same as the browser window. *

- * calculated relative to the main frame viewport - which is usually the same as the browser window. + * Scrolling affects the returned bonding box, similarly to Element.getBoundingClientRect. That means {@code x} and/or {@code y} may be negative. *

- * Scrolling affects the returned bonding box, similarly to + * Elements from child frames return the bounding box relative to the main frame, unlike the Element.getBoundingClientRect. *

- * Element.getBoundingClientRect. That - *

- * means {@code x} and/or {@code y} may be negative. - *

- * Elements from child frames return the bounding box relative to the main frame, unlike the - *

- * Element.getBoundingClientRect. - *

- * Assuming the page is static, it is safe to use bounding box coordinates to perform input. For example, the following - *

- * snippet should click the center of the element. + * Assuming the page is static, it is safe to use bounding box coordinates to perform input. For example, the following snippet should click the center of the element. *

*/ BoundingBox boundingBox(); @@ -657,9 +629,7 @@ public interface ElementHandle extends JSHandle { *

* If the element is detached from the DOM at any moment during the action, this method rejects. *

- * When all steps combined have not finished during the specified {@code timeout}, this method rejects with a TimeoutError. - *

- * Passing zero timeout disables this. + * When all steps combined have not finished during the specified {@code timeout}, this method rejects with a TimeoutError. Passing zero timeout disables this. */ void check(CheckOptions options); default void click() { @@ -678,9 +648,7 @@ public interface ElementHandle extends JSHandle { *

* If the element is detached from the DOM at any moment during the action, this method rejects. *

- * When all steps combined have not finished during the specified {@code timeout}, this method rejects with a TimeoutError. - *

- * Passing zero timeout disables this. + * When all steps combined have not finished during the specified {@code timeout}, this method rejects with a TimeoutError. Passing zero timeout disables this. */ void click(ClickOptions options); /** @@ -703,9 +671,7 @@ public interface ElementHandle extends JSHandle { *

* If the element is detached from the DOM at any moment during the action, this method rejects. *

- * When all steps combined have not finished during the specified {@code timeout}, this method rejects with a TimeoutError. - *

- * Passing zero timeout disables this. + * When all steps combined have not finished during the specified {@code timeout}, this method rejects with a TimeoutError. Passing zero timeout disables this. *

* NOTE {@code elementHandle.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. */ @@ -714,15 +680,9 @@ public interface ElementHandle extends JSHandle { dispatchEvent(type, null); } /** - * The snippet below dispatches the {@code click} event on the element. Regardless of the visibility state of the elment, {@code click} + * The snippet below dispatches the {@code click} event on the element. Regardless of the visibility state of the elment, {@code click} is dispatched. This is equivalend to calling element.click(). *

- * is dispatched. This is equivalend to calling - *

- * element.click(). - *

- * Under the hood, it creates an instance of an event based on the given {@code type}, initializes it with {@code eventInit} properties - *

- * and dispatches it on the element. Events are {@code composed}, {@code cancelable} and bubble by default. + * Under the hood, it creates an instance of an event based on the given {@code type}, initializes it with {@code eventInit} properties and dispatches it on the element. Events are {@code composed}, {@code cancelable} and bubble by default. *

* Since {@code eventInit} is event-specific, please refer to the events documentation for the lists of initial properties: *

@@ -751,11 +711,7 @@ public interface ElementHandle extends JSHandle { fill(value, null); } /** - * This method waits for actionability checks, focuses the element, fills it and triggers an {@code input} - *

- * event after filling. If the element is not an {@code }, {@code