1
0
mirror of synced 2026-08-04 22:46:55 +00:00

docs: remove extra paragraphs from javadoc (#204)

This commit is contained in:
Yury Semikhatsky
2021-01-11 13:42:28 -08:00
committed by GitHub
parent cc1057d910
commit 88bd51ce74
24 changed files with 697 additions and 1352 deletions
@@ -20,23 +20,17 @@ import java.util.*;
/**
* The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by
* <p>
* assistive technology such as [screen readers](https://en.wikipedia.org/wiki/Screen_reader) or
* <p>
* [switches](https://en.wikipedia.org/wiki/Switch_access).
* <p>
* Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might
* <p>
*
* <p> Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might
* have wildly different output.
* <p>
* Blink - Chromium's rendering engine - has a concept of "accessibility tree", which is then translated into different
* <p>
*
* <p> 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.
* <p>
* Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by
* <p>
*
* <p> 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
* <p>
* "interesting" nodes of the tree.
*/
public interface Accessibility {
@@ -64,17 +58,10 @@ public interface Accessibility {
}
/**
* Captures the current state of the accessibility tree. The returned object represents the root accessible node of the
* <p>
* page.
* <p>
* > <strong>NOTE</strong> The Chromium accessibility tree contains nodes that go unused on most platforms and by most screen readers.
* <p>
*
* <p> > <strong>NOTE</strong> 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}.
* <p>
*
* <p>
*
* <p>
*/
AccessibilityNode snapshot(SnapshotOptions options);
}
@@ -21,17 +21,12 @@ import java.util.*;
/**
* - extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
* <p>
* A Browser is created when Playwright connects to a browser instance, either through [{@code method: BrowserType.launch}] or
* <p>
*
* <p> A Browser is created when Playwright connects to a browser instance, either through [{@code method: BrowserType.launch}] or
* [{@code method: BrowserType.connect}].
* <p>
*
* <p>
* See {@code ChromiumBrowser}, [FirefoxBrowser] and [WebKitBrowser] for browser-specific features. Note that
* <p>
*
* <p> See {@code ChromiumBrowser}, [FirefoxBrowser] and [WebKitBrowser] for browser-specific features. Note that
* [{@code method: BrowserType.connect}] and [{@code method: BrowserType.launch}] always return a specific browser instance, based on
* <p>
* the browser being connected to or launched.
*/
public interface Browser {
@@ -639,21 +634,16 @@ public interface Browser {
}
/**
* In case this browser is obtained using [{@code method: BrowserType.launch}], closes the browser and all of its pages (if any
* <p>
* were opened).
* <p>
* In case this browser is obtained using [{@code method: BrowserType.connect}], clears all created contexts belonging to this
* <p>
*
* <p> In case this browser is obtained using [{@code method: BrowserType.connect}], clears all created contexts belonging to this
* browser and disconnects from the browser server.
* <p>
* The {@code Browser} object itself is considered to be disposed and cannot be used anymore.
*
* <p> The {@code Browser} object itself is considered to be disposed and cannot be used anymore.
*/
void close();
/**
* Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts.
* <p>
*
* <p>
*/
List<BrowserContext> contexts();
/**
@@ -665,9 +655,6 @@ public interface Browser {
}
/**
* Creates a new browser context. It won't share cookies/cache with other browser contexts.
* <p>
*
* <p>
*/
BrowserContext newContext(NewContextOptions options);
default Page newPage() {
@@ -675,11 +662,9 @@ public interface Browser {
}
/**
* Creates a new page in a new browser context. Closing this page will close the context as well.
* <p>
* This is a convenience API that should only be used for the single-page scenarios and short snippets. Production code and
* <p>
*
* <p> 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 method: Browser.newContext}] followed by the
* <p>
* [{@code method: BrowserContext.newPage}] to control their exact life times.
*/
Page newPage(NewPageOptions options);
@@ -24,19 +24,14 @@ import java.util.regex.Pattern;
/**
* - extends: [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
* <p>
* BrowserContexts provide a way to operate multiple independent browser sessions.
* <p>
* If a page opens another page, e.g. with a {@code window.open} call, the popup will belong to the parent page's browser
* <p>
*
* <p> BrowserContexts provide a way to operate multiple independent browser sessions.
*
* <p> 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.
* <p>
* Playwright allows creation of "incognito" browser contexts with {@code browser.newContext()} method. "Incognito" browser
* <p>
*
* <p> Playwright allows creation of "incognito" browser contexts with {@code browser.newContext()} method. "Incognito" browser
* contexts don't write any browsing data to disk.
* <p>
*
* <p>
*/
public interface BrowserContext {
enum SameSite { STRICT, LAX, NONE }
@@ -270,11 +265,7 @@ public interface BrowserContext {
}
/**
* Adds cookies into this browser context. All pages within this context will have these cookies installed. Cookies can be
* <p>
* obtained via [{@code method: BrowserContext.cookies}].
* <p>
*
* <p>
*/
void addCookies(List<AddCookie> cookies);
default void addInitScript(String script) {
@@ -282,24 +273,16 @@ public interface BrowserContext {
}
/**
* Adds a script which would be evaluated in one of the following scenarios:
* <p>
* - Whenever a page is created in the browser context or is navigated.
* <p>
* - Whenever a child frame is attached or navigated in any page in the browser context. In this case, the script is
* <p>
* evaluated in the context of the newly attached frame.
* <p>
* The script is evaluated after the document was created but before any of its scripts were run. This is useful to amend
* <p>
*
* <p> 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}.
* <p>
*
* <p>
*
* <p>
* > <strong>NOTE</strong> The order of evaluation of multiple scripts installed via [{@code method: BrowserContext.addInitScript}] and
* <p>
*
* <p> > <strong>NOTE</strong> The order of evaluation of multiple scripts installed via [{@code method: BrowserContext.addInitScript}] and
* [{@code method: Page.addInitScript}] 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).
*/
@@ -314,23 +297,20 @@ public interface BrowserContext {
void clearCookies();
/**
* Clears all permission overrides for the browser context.
* <p>
*
* <p>
*/
void clearPermissions();
/**
* Closes the browser context. All the pages that belong to the browser context will be closed.
* <p>
* > <strong>NOTE</strong> the default browser context cannot be closed.
*
* <p> > <strong>NOTE</strong> the default browser context cannot be closed.
*/
void close();
default List<Cookie> cookies() { return cookies((List<String>) null); }
default List<Cookie> 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
* <p>
* are returned.
*
* @param urls Optional list of URLs.
*/
List<Cookie> cookies(List<String> urls);
@@ -339,38 +319,28 @@ public interface BrowserContext {
}
/**
* The method adds a function called {@code name} on the {@code window} object of every frame in every page in the context. When
* <p>
* called, the function executes {@code callback} and returns a [Promise] which resolves to the return value of {@code callback}. If
* <p>
* the {@code callback} returns a [Promise], it will be awaited.
* <p>
* The first argument of the {@code callback} function contains information about the caller: `{ browserContext: BrowserContext,
* <p>
*
* <p> The first argument of the {@code callback} function contains information about the caller: `{ browserContext: BrowserContext,
* page: Page, frame: Frame }`.
* <p>
* See [{@code method: Page.exposeBinding}] for page-only version.
* <p>
*
* <p>
*
* <p>
*
*
* <p> See [{@code method: Page.exposeBinding}] for page-only version.
*
*
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
*/
void exposeBinding(String name, Page.Binding callback, 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
* <p>
* called, the function executes {@code callback} and returns a [Promise] which resolves to the return value of {@code callback}.
* <p>
* If the {@code callback} returns a [Promise], it will be awaited.
* <p>
* See [{@code method: Page.exposeFunction}] for page-only version.
* <p>
*
* <p>
*
*
* <p> If the {@code callback} returns a [Promise], it will be awaited.
*
* <p> See [{@code method: Page.exposeFunction}] for page-only version.
*
*
* @param name Name of the function on the window object.
* @param callback Callback function that will be called in the Playwright's context.
*/
@@ -380,8 +350,8 @@ public interface BrowserContext {
}
/**
* Grants specified permissions to the browser context. Only grants corresponding permissions to the given origin if
* <p>
* specified.
*
* @param permissions A permission or an array of permissions to grant. Permissions can be one of the following values:
* - {@code 'geolocation'}
* - {@code 'midi'}
@@ -407,7 +377,6 @@ 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
* <p>
* find them using [{@code method: ChromiumBrowserContext.backgroundPages}].
*/
List<Page> pages();
@@ -415,77 +384,63 @@ public interface BrowserContext {
void route(Pattern url, Consumer<Route> handler);
/**
* Routing provides the capability to modify network requests that are made by any page in the browser context. Once route
* <p>
* is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted.
* <p>
*
* <p>
* or the same snippet using a regex pattern instead:
* <p>
*
* <p>
* Page routes (set up with [{@code method: Page.route}]) take precedence over browser context routes when request matches both
* <p>
*
* <p> or the same snippet using a regex pattern instead:
*
* <p> Page routes (set up with [{@code method: Page.route}]) take precedence over browser context routes when request matches both
* handlers.
* <p>
* > <strong>NOTE</strong> Enabling routing disables http cache.
*
* <p> > <strong>NOTE</strong> Enabling routing disables http cache.
*
* @param url A glob pattern, regex pattern or predicate receiving [URL] to match while routing.
* @param handler handler function to route the request.
*/
void route(Predicate<String> url, Consumer<Route> handler);
/**
* This setting will change the default maximum navigation time for the following methods and related shortcuts:
* <p>
* - [{@code method: Page.goBack}]
* <p>
* - [{@code method: Page.goForward}]
* <p>
* - [{@code method: Page.goto}]
* <p>
* - [{@code method: Page.reload}]
* <p>
* - [{@code method: Page.setContent}]
* <p>
* - [{@code method: Page.waitForNavigation}]
* <p>
* > <strong>NOTE</strong> [{@code method: Page.setDefaultNavigationTimeout}] and [{@code method: Page.setDefaultTimeout}] take priority over
* <p>
*
* <p> > <strong>NOTE</strong> [{@code method: Page.setDefaultNavigationTimeout}] and [{@code method: Page.setDefaultTimeout}] take priority over
* [{@code method: BrowserContext.setDefaultNavigationTimeout}].
*
* @param timeout Maximum navigation time in milliseconds
*/
void setDefaultNavigationTimeout(double timeout);
/**
* This setting will change the default maximum time for all the methods accepting {@code timeout} option.
* <p>
* > <strong>NOTE</strong> [{@code method: Page.setDefaultNavigationTimeout}], [{@code method: Page.setDefaultTimeout}] and
* <p>
*
* <p> > <strong>NOTE</strong> [{@code method: Page.setDefaultNavigationTimeout}], [{@code method: Page.setDefaultTimeout}] and
* [{@code method: BrowserContext.setDefaultNavigationTimeout}] take priority over [{@code method: BrowserContext.setDefaultTimeout}].
*
* @param timeout Maximum time in milliseconds
*/
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
* <p>
* with page-specific extra HTTP headers set with [{@code method: Page.setExtraHTTPHeaders}]. If page overrides a particular
* <p>
* header, page-specific header value will be used instead of the browser context header value.
* <p>
* > <strong>NOTE</strong> {@code browserContext.setExtraHTTPHeaders} does not guarantee the order of headers in the outgoing requests.
*
* <p> > <strong>NOTE</strong> {@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.
*/
void setExtraHTTPHeaders(Map<String, String> headers);
/**
* Sets the context's geolocation. Passing {@code null} or {@code undefined} emulates position unavailable.
* <p>
*
* <p>
* > <strong>NOTE</strong> Consider using [{@code method: BrowserContext.grantPermissions}] to grant permissions for the browser context pages
* <p>
*
* <p> > <strong>NOTE</strong> Consider using [{@code method: BrowserContext.grantPermissions}] to grant permissions for the browser context pages
* to read its geolocation.
*/
void setGeolocation(Geolocation geolocation);
/**
*
*
*
* @param offline Whether to emulate network being offline for the browser context.
*/
void setOffline(boolean offline);
@@ -503,8 +458,8 @@ public interface BrowserContext {
void unroute(Pattern url, Consumer<Route> handler);
/**
* Removes a route created with [{@code method: BrowserContext.route}]. When {@code handler} is not specified, removes all routes for
* <p>
* the {@code url}.
*
* @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with
* [{@code method: BrowserContext.route}].
* @param handler Optional handler function used to register a routing with [{@code method: BrowserContext.route}].
@@ -520,12 +475,9 @@ public interface BrowserContext {
}
/**
* Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
* <p>
* value. Will throw an error if the context closes before the event is fired. Returns the event data value.
* <p>
*
* <p>
*
*
*
* @param event Event name, same one would pass into {@code browserContext.on(event)}.
*/
Deferred<Event<EventType>> futureEvent(EventType event, FutureEventOptions options);
@@ -21,11 +21,7 @@ import java.util.*;
/**
* BrowserType provides methods to launch a specific browser instance or connect to an existing one. The following is a
* <p>
* typical example of using Playwright to drive automation:
* <p>
*
* <p>
*/
public interface BrowserType {
class LaunchOptions {
@@ -625,37 +621,22 @@ public interface BrowserType {
}
/**
* Returns the browser instance.
* <p>
* You can use {@code ignoreDefaultArgs} to filter out {@code --mute-audio} from default arguments:
* <p>
*
* <p>
* > **Chromium-only** Playwright can also be used to control the Chrome browser, but it works best with the version of
* <p>
*
* <p> You can use {@code ignoreDefaultArgs} to filter out {@code --mute-audio} from default arguments:
*
* <p> > **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
* <p>
* extreme caution.
* <p>
* >
* <p>
* > If Google Chrome (rather than Chromium) is preferred, a
* <p>
* [Chrome Canary](https://www.google.com/chrome/browser/canary.html) or
* <p>
* [Dev Channel](https://www.chromium.org/getting-involved/dev-channel) build is suggested.
* <p>
* >
* <p>
* > In [{@code method: BrowserType.launch}] above, any mention of Chromium also applies to Chrome.
* <p>
* >
* <p>
* > See [{@code this article}](https://www.howtogeek.com/202825/what%E2%80%99s-the-difference-between-chromium-and-chrome/) for
* <p>
* a description of the differences between Chromium and Chrome.
* <p>
* [{@code This article}](https://chromium.googlesource.com/chromium/src/+/lkgr/docs/chromium_browser_vs_google_chrome.md)
* <p>
* describes some differences for Linux users.
*/
Browser launch(LaunchOptions options);
@@ -664,10 +645,10 @@ public interface BrowserType {
}
/**
* Returns the persistent browser context instance.
* <p>
* Launches browser that uses persistent storage located at {@code userDataDir} and returns the only context. Closing this
* <p>
*
* <p> 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](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md) and
* [Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile).
@@ -51,9 +51,7 @@ public interface ConsoleMessage {
String text();
/**
* One of the following values: {@code 'log'}, {@code 'debug'}, {@code 'info'}, {@code 'error'}, {@code 'warning'}, {@code 'dir'}, {@code 'dirxml'}, {@code 'table'},
* <p>
* {@code 'trace'}, {@code 'clear'}, {@code 'startGroup'}, {@code 'startGroupCollapsed'}, {@code 'endGroup'}, {@code 'assert'}, {@code 'profile'}, {@code 'profileEnd'},
* <p>
* {@code 'count'}, {@code 'timeEnd'}.
*/
String type();
@@ -20,9 +20,6 @@ import java.util.*;
/**
* {@code Dialog} objects are dispatched by page via the [{@code event: Page.dialog}] event.
* <p>
*
* <p>
*/
public interface Dialog {
enum Type { ALERT, BEFOREUNLOAD, CONFIRM, PROMPT }
@@ -32,6 +29,7 @@ public interface Dialog {
}
/**
* Returns when the dialog has been accepted.
*
* @param promptText A text to enter in prompt. Does not cause any effects if the dialog's {@code type} is not prompt. Optional.
*/
void accept(String promptText);
@@ -22,19 +22,14 @@ import java.util.*;
/**
* {@code Download} objects are dispatched by page via the [{@code event: Page.download}] event.
* <p>
* All the downloaded files belonging to the browser context are deleted when the browser context is closed. All downloaded
* <p>
*
* <p> 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.
* <p>
* Download event is emitted once the download starts. Download path becomes available once download completes:
* <p>
*
* <p>
* > <strong>NOTE</strong> Browser context **must** be created with the {@code acceptDownloads} set to {@code true} when user needs access to the
* <p>
*
* <p> Download event is emitted once the download starts. Download path becomes available once download completes:
*
* <p> > <strong>NOTE</strong> 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
* <p>
* download is not performed and user has no access to the downloaded files.
*/
public interface Download {
@@ -56,16 +51,14 @@ public interface Download {
Path path();
/**
* Saves the download to a user-specified path.
*
* @param path Path where the download should be saved.
*/
void saveAs(Path path);
/**
* Returns suggested filename for this download. It is typically computed by the browser from the
* <p>
* [{@code Content-Disposition}](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) response header
* <p>
* or the {@code download} attribute. See the spec on [whatwg](https://html.spec.whatwg.org/#downloading-resources). Different
* <p>
* browsers can use different logic for computing it.
*/
String suggestedFilename();
@@ -21,16 +21,13 @@ import java.util.*;
/**
* - extends: {@code JSHandle}
* <p>
* ElementHandle represents an in-page DOM element. ElementHandles can be created with the [{@code method: Page.$}] method.
* <p>
*
* <p>
* ElementHandle prevents DOM element from garbage collection unless the handle is disposed with
* <p>
*
* <p> ElementHandle represents an in-page DOM element. ElementHandles can be created with the [{@code method: Page.$}] method.
*
* <p> ElementHandle prevents DOM element from garbage collection unless the handle is disposed with
* [{@code method: JSHandle.dispose}]. ElementHandles are auto-disposed when their origin frame gets navigated.
* <p>
* ElementHandle instances can be used as an argument in [{@code method: Page.$eval}] and [{@code method: Page.evaluate}] methods.
*
* <p> ElementHandle instances can be used as an argument in [{@code method: Page.$eval}] and [{@code method: Page.evaluate}] methods.
*/
public interface ElementHandle extends JSHandle {
class BoundingBox {
@@ -609,19 +606,17 @@ public interface ElementHandle extends JSHandle {
}
/**
* The method finds an element matching the specified selector in the {@code ElementHandle}'s subtree. See
* <p>
* [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector,
* <p>
* returns {@code null}.
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#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
* <p>
* [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector,
* <p>
* returns empty array.
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
List<ElementHandle> querySelectorAll(String selector);
@@ -630,20 +625,14 @@ public interface ElementHandle extends JSHandle {
}
/**
* Returns the return value of {@code pageFunction}
* <p>
* The method finds an element matching the specified selector in the {@code ElementHandle}s subtree and passes it as a first
* <p>
*
* <p> 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](./selectors.md#working-with-selectors) for more details. If no
* <p>
* elements match the selector, the method throws an error.
* <p>
* If {@code pageFunction} returns a [Promise], then {@code frame.$eval} would wait for the promise to resolve and return its value.
* <p>
* Examples:
* <p>
*
* <p>
*
*
* <p> If {@code pageFunction} returns a [Promise], then {@code frame.$eval} would wait for the promise to resolve and return its value.
*
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param pageFunction Function to be evaluated in browser context
* @param arg Optional argument to pass to {@code pageFunction}
@@ -654,22 +643,14 @@ public interface ElementHandle extends JSHandle {
}
/**
* Returns the return value of {@code pageFunction}
* <p>
* The method finds all elements matching the specified selector in the {@code ElementHandle}'s subtree and passes an array of
* <p>
*
* <p> 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
* <p>
* [Working with selectors](./selectors.md#working-with-selectors) for more details.
* <p>
* If {@code pageFunction} returns a [Promise], then {@code frame.$$eval} would wait for the promise to resolve and return its value.
* <p>
* Examples:
* <p>
*
* <p>
*
* <p>
*
*
* <p> If {@code pageFunction} returns a [Promise], then {@code frame.$$eval} would wait for the promise to resolve and return its value.
*
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param pageFunction Function to be evaluated in browser context
* @param arg Optional argument to pass to {@code pageFunction}
@@ -677,25 +658,17 @@ 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
* <p>
* calculated relative to the main frame viewport - which is usually the same as the browser window.
* <p>
* Scrolling affects the returned bonding box, similarly to
* <p>
*
* <p> Scrolling affects the returned bonding box, similarly to
* [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect). That
* <p>
* means {@code x} and/or {@code y} may be negative.
* <p>
* Elements from child frames return the bounding box relative to the main frame, unlike the
* <p>
*
* <p> Elements from child frames return the bounding box relative to the main frame, unlike the
* [Element.getBoundingClientRect](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
* <p>
* Assuming the page is static, it is safe to use bounding box coordinates to perform input. For example, the following
* <p>
*
* <p> 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.
* <p>
*
* <p>
*/
BoundingBox boundingBox();
default void check() {
@@ -703,25 +676,17 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method checks the element by performing the following steps:
* <p>
* 1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already
* <p>
* checked, this method returns immediately.
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the element, unless {@code force} option is set.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to click in the center of the element.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* 1. Ensure that the element is now checked. If not, this method rejects.
* <p>
* If the element is detached from the DOM at any moment during the action, this method rejects.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> If the element is detached from the DOM at any moment during the action, this method rejects.
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
*/
void check(CheckOptions options);
@@ -730,19 +695,14 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method clicks the element by performing the following steps:
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the element, unless {@code force} option is set.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to click in the center of the element, or the specified {@code position}.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* If the element is detached from the DOM at any moment during the action, this method rejects.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> If the element is detached from the DOM at any moment during the action, this method rejects.
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
*/
void click(ClickOptions options);
@@ -755,24 +715,18 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method double clicks the element by performing the following steps:
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the element, unless {@code force} option is set.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to double click in the center of the element, or the specified {@code position}.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set. Note that if the
* <p>
* first click of the {@code dblclick()} triggers a navigation event, this method will reject.
* <p>
* If the element is detached from the DOM at any moment during the action, this method rejects.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> If the element is detached from the DOM at any moment during the action, this method rejects.
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
* <p>
* > <strong>NOTE</strong> {@code elementHandle.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event.
*
* <p> > <strong>NOTE</strong> {@code elementHandle.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event.
*/
void dblclick(DblclickOptions options);
default void dispatchEvent(String type) {
@@ -780,38 +734,24 @@ public interface ElementHandle extends JSHandle {
}
/**
* The snippet below dispatches the {@code click} event on the element. Regardless of the visibility state of the elment, {@code click}
* <p>
* is dispatched. This is equivalend to calling
* <p>
* [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
* <p>
*
* <p>
* Under the hood, it creates an instance of an event based on the given {@code type}, initializes it with {@code eventInit} properties
* <p>
*
* <p> 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.
* <p>
* Since {@code eventInit} is event-specific, please refer to the events documentation for the lists of initial properties:
* <p>
*
* <p> Since {@code eventInit} is event-specific, please refer to the events documentation for the lists of initial properties:
* - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
* <p>
* - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
* <p>
* - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
* <p>
* - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
* <p>
* - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
* <p>
* - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
* <p>
* - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
* <p>
* You can also specify {@code JSHandle} as the property value if you want live objects to be passed into the event:
* <p>
*
* <p>
*
*
* <p> You can also specify {@code JSHandle} as the property value if you want live objects to be passed into the event:
*
*
* @param type DOM event type: {@code "click"}, {@code "dragstart"}, etc.
* @param eventInit Optional event-specific initialization properties.
*/
@@ -821,10 +761,9 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an {@code input}
* <p>
* event after filling. If the element is not an {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element, this method throws
* <p>
* an error. Note that you can pass an empty string to clear the input field.
*
* @param value Value to set for the {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element.
*/
void fill(String value, FillOptions options);
@@ -834,6 +773,7 @@ public interface ElementHandle extends JSHandle {
void focus();
/**
* Returns element attribute value.
*
* @param name Attribute name to get the value for.
*/
String getAttribute(String name);
@@ -842,19 +782,14 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method hovers over the element by performing the following steps:
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the element, unless {@code force} option is set.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to hover over the center of the element, or the specified {@code position}.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* If the element is detached from the DOM at any moment during the action, this method rejects.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> If the element is detached from the DOM at any moment during the action, this method rejects.
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
*/
void hover(HoverOptions options);
@@ -875,28 +810,24 @@ public interface ElementHandle extends JSHandle {
}
/**
* Focuses the element, and then uses [{@code method: Keyboard.down}] and [{@code method: Keyboard.up}].
* <p>
* {@code key} can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
* <p>
*
* <p> {@code key} can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
* value or a single character to generate the text for. A superset of the {@code key} values can be found
* <p>
* [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
* <p>
* {@code F1} - {@code F12}, {@code Digit0}- {@code Digit9}, {@code KeyA}- {@code KeyZ}, {@code Backquote}, {@code Minus}, {@code Equal}, {@code Backslash}, {@code Backspace}, {@code Tab},
* <p>
*
* <p> {@code F1} - {@code F12}, {@code Digit0}- {@code Digit9}, {@code KeyA}- {@code KeyZ}, {@code Backquote}, {@code Minus}, {@code Equal}, {@code Backslash}, {@code Backspace}, {@code Tab},
* {@code Delete}, {@code Escape}, {@code ArrowDown}, {@code End}, {@code Enter}, {@code Home}, {@code Insert}, {@code PageDown}, {@code PageUp}, {@code ArrowRight}, {@code ArrowUp}, etc.
* <p>
* Following modification shortcuts are also supported: {@code Shift}, {@code Control}, {@code Alt}, {@code Meta}, {@code ShiftLeft}.
* <p>
* Holding down {@code Shift} will type the text that corresponds to the {@code key} in the upper case.
* <p>
* If {@code key} is a single character, it is case-sensitive, so the values {@code a} and {@code A} will generate different respective
* <p>
*
* <p> Following modification shortcuts are also supported: {@code Shift}, {@code Control}, {@code Alt}, {@code Meta}, {@code ShiftLeft}.
*
* <p> Holding down {@code Shift} will type the text that corresponds to the {@code key} in the upper case.
*
* <p> If {@code key} is a single character, it is case-sensitive, so the values {@code a} and {@code A} will generate different respective
* texts.
* <p>
* Shortcuts such as {@code key: "Control+o"} or {@code key: "Control+Shift+T"} are supported as well. When speficied with the
* <p>
*
* <p> Shortcuts such as {@code key: "Control+o"} or {@code key: "Control+Shift+T"} are supported as well. When speficied with the
* modifier, modifier is pressed and being held while the subsequent key is being pressed.
*
* @param key Name of the key to press or a character to generate, such as {@code ArrowLeft} or {@code a}.
*/
void press(String key, PressOptions options);
@@ -905,9 +836,8 @@ public interface ElementHandle extends JSHandle {
}
/**
* Returns the buffer with the captured screenshot.
* <p>
* This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a
* <p>
*
* <p> This method waits for the [actionability](./actionability.md) checks, then scrolls element into view before taking a
* screenshot. If the element is detached from DOM, the method throws an error.
*/
byte[] screenshot(ScreenshotOptions options);
@@ -916,13 +846,10 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method waits for [actionability](./actionability.md) checks, then tries to scroll element into view, unless it is
* <p>
* completely visible as defined by
* <p>
* [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s .
* <p>
* Throws when {@code elementHandle} does not point to an element
* <p>
* [IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)'s ``{@code ratio}``.
*
* <p> Throws when {@code elementHandle} does not point to an element
* [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
*/
void scrollIntoViewIfNeeded(ScrollIntoViewIfNeededOptions options);
@@ -966,14 +893,11 @@ public interface ElementHandle extends JSHandle {
}
/**
* Returns the array of option values that have been successfully selected.
* <p>
* Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
* <p>
*
* <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
* element, the method throws an error.
* <p>
*
* <p>
*
*
*
* @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
* first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
* is considered matching if all specified properties match.
@@ -984,7 +908,6 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text
* <p>
* content.
*/
void selectText(SelectTextOptions options);
@@ -997,11 +920,9 @@ public interface ElementHandle extends JSHandle {
default void setInputFiles(FileChooser.FilePayload[] files) { setInputFiles(files, null); }
/**
* This method expects {@code elementHandle} to point to an
* <p>
* [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
* <p>
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
* <p>
*
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
* are resolved relative to the the current working directory. For empty array, clears the selected files.
*/
void setInputFiles(FileChooser.FilePayload[] files, SetInputFilesOptions options);
@@ -1010,22 +931,17 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method taps the element by performing the following steps:
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the element, unless {@code force} option is set.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.touchscreen}] to tap the center of the element, or the specified {@code position}.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* If the element is detached from the DOM at any moment during the action, this method rejects.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> If the element is detached from the DOM at any moment during the action, this method rejects.
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
* <p>
* > <strong>NOTE</strong> {@code elementHandle.tap()} requires that the {@code hasTouch} option of the browser context be set to true.
*
* <p> > <strong>NOTE</strong> {@code elementHandle.tap()} requires that the {@code hasTouch} option of the browser context be set to true.
*/
void tap(TapOptions options);
/**
@@ -1037,14 +953,10 @@ public interface ElementHandle extends JSHandle {
}
/**
* Focuses the element, and then sends a {@code keydown}, {@code keypress}/{@code input}, and {@code keyup} event for each character in the text.
* <p>
* To press a special key, like {@code Control} or {@code ArrowDown}, use [{@code method: ElementHandle.press}].
* <p>
*
* <p>
*
* <p>
*
*
* <p> To press a special key, like {@code Control} or {@code ArrowDown}, use [{@code method: ElementHandle.press}].
*
*
* @param text A text to type into a focused element.
*/
void type(String text, TypeOptions options);
@@ -1053,25 +965,17 @@ public interface ElementHandle extends JSHandle {
}
/**
* This method checks the element by performing the following steps:
* <p>
* 1. Ensure that element is a checkbox or a radio input. If not, this method rejects. If the element is already
* <p>
* unchecked, this method returns immediately.
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the element, unless {@code force} option is set.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to click in the center of the element.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* 1. Ensure that the element is now unchecked. If not, this method rejects.
* <p>
* If the element is detached from the DOM at any moment during the action, this method rejects.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> If the element is detached from the DOM at any moment during the action, this method rejects.
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
*/
void uncheck(UncheckOptions options);
@@ -1080,26 +984,19 @@ public interface ElementHandle extends JSHandle {
}
/**
* Returns when the element satisfies the {@code state}.
* <p>
* Depending on the {@code state} parameter, this method waits for one of the [actionability](./actionability.md) checks to pass.
* <p>
*
* <p> Depending on the {@code state} parameter, this method waits for one of the [actionability](./actionability.md) checks to pass.
* This method throws when the element is detached while waiting, unless waiting for the {@code "hidden"} state.
* <p>
* - {@code "visible"} Wait until the element is [visible](./actionability.md#visible).
* <p>
* - {@code "hidden"} Wait until the element is [not visible](./actionability.md#visible) or
* <p>
* [not attached](./actionability.md#attached). Note that waiting for hidden does not throw when the element detaches.
* <p>
* - {@code "stable"} Wait until the element is both [visible](./actionability.md#visible) and
* <p>
* [stable](./actionability.md#stable).
* <p>
* - {@code "enabled"} Wait until the element is [enabled](./actionability.md#enabled).
* <p>
* - {@code "disabled"} Wait until the element is [not enabled](./actionability.md#enabled).
* <p>
* If the element does not satisfy the condition for the {@code timeout} milliseconds, this method will throw.
*
* <p> If the element does not satisfy the condition for the {@code timeout} milliseconds, this method will throw.
*
* @param state A state to wait for, see below for more details.
*/
void waitForElementState(ElementState state, WaitForElementStateOptions options);
@@ -1108,20 +1005,15 @@ public interface ElementHandle extends JSHandle {
}
/**
* Returns element specified by selector when it satisfies {@code state} option. Returns {@code null} if waiting for {@code hidden} or
* <p>
* {@code detached}.
* <p>
* Wait for the {@code selector} relative to the element handle to satisfy {@code state} option (either appear/disappear from dom, or
* <p>
*
* <p> Wait for the {@code selector} relative to the element handle to satisfy {@code state} option (either appear/disappear from dom, or
* become visible/hidden). If at the moment of calling the method {@code selector} already satisfies the condition, the method
* <p>
* will return immediately. If the selector doesn't satisfy the condition for the {@code timeout} milliseconds, the function will
* <p>
* throw.
* <p>
*
* <p>
* > <strong>NOTE</strong> This method does not work across navigations, use [{@code method: Page.waitForSelector}] instead.
*
* <p> > <strong>NOTE</strong> This method does not work across navigations, use [{@code method: Page.waitForSelector}] instead.
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
ElementHandle waitForSelector(String selector, WaitForSelectorOptions options);
@@ -21,9 +21,6 @@ import java.util.*;
/**
* {@code FileChooser} objects are dispatched by the page in the [{@code event: Page.filechooser}] event.
* <p>
*
* <p>
*/
public interface FileChooser {
class FilePayload {
@@ -81,7 +78,6 @@ public interface FileChooser {
default void setFiles(FileChooser.FilePayload[] files) { setFiles(files, null); }
/**
* Sets the value of the file input this chooser is associated with. If some of the {@code filePaths} are relative paths, then
* <p>
* they are resolved relative to the the current working directory. For empty array, clears the selected files.
*/
void setFiles(FileChooser.FilePayload[] files, SetFilesOptions options);
@@ -23,25 +23,14 @@ import java.util.regex.Pattern;
/**
* At every point of time, page exposes its current frame tree via the [{@code method: Page.mainFrame}] and
* <p>
* [{@code method: Frame.childFrames}] methods.
* <p>
* {@code Frame} object's lifecycle is controlled by three events, dispatched on the page object:
* <p>
*
* <p> {@code Frame} object's lifecycle is controlled by three events, dispatched on the page object:
* - [{@code event: Page.frameattached}] - fired when the frame gets attached to the page. A Frame can be attached to the page
* <p>
* only once.
* <p>
* - [{@code event: Page.framenavigated}] - fired when the frame commits navigation to a different URL.
* <p>
* - [{@code event: Page.framedetached}] - fired when the frame gets detached from the page. A Frame can be detached from the
* <p>
* page only once.
* <p>
*
* <p>
*
* <p>
*/
public interface Frame {
enum LoadState { LOAD, DOMCONTENTLOADED, NETWORKIDLE }
@@ -788,23 +777,21 @@ public interface Frame {
}
/**
* Returns the ElementHandle pointing to the frame element.
* <p>
* The method finds an element matching the specified selector within the frame. See
* <p>
*
* <p> The method finds an element matching the specified selector within the frame. See
* [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector,
* <p>
* returns {@code null}.
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
ElementHandle querySelector(String selector);
/**
* Returns the ElementHandles pointing to the frame elements.
* <p>
* The method finds all elements matching the specified selector within the frame. See
* <p>
*
* <p> The method finds all elements matching the specified selector within the frame. See
* [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements match the selector,
* <p>
* returns empty array.
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
List<ElementHandle> querySelectorAll(String selector);
@@ -813,20 +800,14 @@ public interface Frame {
}
/**
* Returns the return value of {@code pageFunction}
* <p>
* The method finds an element matching the specified selector within the frame and passes it as a first argument to
* <p>
*
* <p> The method finds an element matching the specified selector within the frame and passes it as a first argument to
* {@code pageFunction}. See [Working with selectors](./selectors.md#working-with-selectors) for more details. If no elements
* <p>
* match the selector, the method throws an error.
* <p>
* If {@code pageFunction} returns a [Promise], then {@code frame.$eval} would wait for the promise to resolve and return its value.
* <p>
* Examples:
* <p>
*
* <p>
*
*
* <p> If {@code pageFunction} returns a [Promise], then {@code frame.$eval} would wait for the promise to resolve and return its value.
*
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param pageFunction Function to be evaluated in browser context
* @param arg Optional argument to pass to {@code pageFunction}
@@ -837,20 +818,14 @@ public interface Frame {
}
/**
* Returns the return value of {@code pageFunction}
* <p>
* The method finds all elements matching the specified selector within the frame and passes an array of matched elements
* <p>
*
* <p> The method finds all elements matching the specified selector within the frame and passes an array of matched elements
* as a first argument to {@code pageFunction}. See [Working with selectors](./selectors.md#working-with-selectors) for more
* <p>
* details.
* <p>
* If {@code pageFunction} returns a [Promise], then {@code frame.$$eval} would wait for the promise to resolve and return its value.
* <p>
* Examples:
* <p>
*
* <p>
*
*
* <p> If {@code pageFunction} returns a [Promise], then {@code frame.$$eval} would wait for the promise to resolve and return its value.
*
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param pageFunction Function to be evaluated in browser context
* @param arg Optional argument to pass to {@code pageFunction}
@@ -858,15 +833,14 @@ public interface Frame {
Object evalOnSelectorAll(String selector, String pageFunction, Object arg);
/**
* Returns the added tag when the script's onload fires or when the script content was injected into frame.
* <p>
* Adds a {@code <script>} tag into the page with the desired url or content.
*
* <p> Adds a {@code <script>} tag into the page with the desired url or content.
*/
ElementHandle addScriptTag(AddScriptTagParams params);
/**
* Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.
* <p>
* Adds a {@code <link rel="stylesheet">} tag into the page with the desired url or a {@code <style type="text/css">} tag with the
* <p>
*
* <p> Adds a {@code <link rel="stylesheet">} tag into the page with the desired url or a {@code <style type="text/css">} tag with the
* content.
*/
ElementHandle addStyleTag(AddStyleTagParams params);
@@ -875,28 +849,19 @@ public interface Frame {
}
/**
* This method checks an element matching {@code selector} by performing the following steps:
* <p>
* 1. Find an element match matching {@code selector}. If there is none, wait until a matching element is attached to the DOM.
* <p>
* 1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already
* <p>
* checked, this method returns immediately.
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the matched element, unless {@code force} option is set. If the
* <p>
* element is detached during the checks, the whole action is retried.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to click in the center of the element.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* 1. Ensure that the element is now checked. If not, this method rejects.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -907,22 +872,16 @@ public interface Frame {
}
/**
* This method clicks an element matching {@code selector} by performing the following steps:
* <p>
* 1. Find an element match matching {@code selector}. If there is none, wait until a matching element is attached to the DOM.
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the matched element, unless {@code force} option is set. If the
* <p>
* element is detached during the checks, the whole action is retried.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to click in the center of the element, or the specified {@code position}.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -936,26 +895,19 @@ public interface Frame {
}
/**
* This method double clicks an element matching {@code selector} by performing the following steps:
* <p>
* 1. Find an element match matching {@code selector}. If there is none, wait until a matching element is attached to the DOM.
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the matched element, unless {@code force} option is set. If the
* <p>
* element is detached during the checks, the whole action is retried.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to double click in the center of the element, or the specified {@code position}.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set. Note that if the
* <p>
* first click of the {@code dblclick()} triggers a navigation event, this method will reject.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
* <p>
* > <strong>NOTE</strong> {@code frame.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event.
*
* <p> > <strong>NOTE</strong> {@code frame.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -968,38 +920,24 @@ public interface Frame {
}
/**
* The snippet below dispatches the {@code click} event on the element. Regardless of the visibility state of the elment, {@code click}
* <p>
* is dispatched. This is equivalend to calling
* <p>
* [element.click()](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click).
* <p>
*
* <p>
* Under the hood, it creates an instance of an event based on the given {@code type}, initializes it with {@code eventInit} properties
* <p>
*
* <p> 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.
* <p>
* Since {@code eventInit} is event-specific, please refer to the events documentation for the lists of initial properties:
* <p>
*
* <p> Since {@code eventInit} is event-specific, please refer to the events documentation for the lists of initial properties:
* - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
* <p>
* - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
* <p>
* - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
* <p>
* - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
* <p>
* - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
* <p>
* - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
* <p>
* - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
* <p>
* You can also specify {@code JSHandle} as the property value if you want live objects to be passed into the event:
* <p>
*
* <p>
*
*
* <p> You can also specify {@code JSHandle} as the property value if you want live objects to be passed into the event:
*
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param type DOM event type: {@code "click"}, {@code "dragstart"}, etc.
@@ -1011,28 +949,19 @@ public interface Frame {
}
/**
* Returns the return value of {@code pageFunction}
* <p>
* If the function passed to the {@code frame.evaluate} returns a [Promise], then {@code frame.evaluate} would wait for the promise to
* <p>
*
* <p> If the function passed to the {@code frame.evaluate} returns a [Promise], then {@code frame.evaluate} would wait for the promise to
* resolve and return its value.
* <p>
* If the function passed to the {@code frame.evaluate} returns a non-[Serializable] value, then {@code frame.evaluate} returns
* <p>
*
* <p> If the function passed to the {@code frame.evaluate} returns a non-[Serializable] value, then {@code frame.evaluate} returns
* {@code undefined}. DevTools Protocol also supports transferring some additional values that are not serializable by {@code JSON}:
* <p>
* {@code -0}, {@code NaN}, {@code Infinity}, {@code -Infinity}, and bigint literals.
* <p>
*
* <p>
* A string can also be passed in instead of a function.
* <p>
*
* <p>
* {@code ElementHandle} instances can be passed as an argument to the {@code frame.evaluate}:
* <p>
*
* <p>
*
*
* <p> A string can also be passed in instead of a function.
*
* <p> {@code ElementHandle} instances can be passed as an argument to the {@code frame.evaluate}:
*
*
* @param pageFunction Function to be evaluated in browser context
* @param arg Optional argument to pass to {@code pageFunction}
*/
@@ -1042,26 +971,18 @@ public interface Frame {
}
/**
* Returns the return value of {@code pageFunction} as in-page object (JSHandle).
* <p>
* The only difference between {@code frame.evaluate} and {@code frame.evaluateHandle} is that {@code frame.evaluateHandle} returns in-page
* <p>
*
* <p> The only difference between {@code frame.evaluate} and {@code frame.evaluateHandle} is that {@code frame.evaluateHandle} returns in-page
* object (JSHandle).
* <p>
* If the function, passed to the {@code frame.evaluateHandle}, returns a [Promise], then {@code frame.evaluateHandle} would wait for
* <p>
*
* <p> If the function, passed to the {@code frame.evaluateHandle}, returns a [Promise], then {@code frame.evaluateHandle} would wait for
* the promise to resolve and return its value.
* <p>
*
* <p>
* A string can also be passed in instead of a function.
* <p>
*
* <p>
* {@code JSHandle} instances can be passed as an argument to the {@code frame.evaluateHandle}:
* <p>
*
* <p>
*
*
* <p> A string can also be passed in instead of a function.
*
* <p> {@code JSHandle} instances can be passed as an argument to the {@code frame.evaluateHandle}:
*
*
* @param pageFunction Function to be evaluated in the page context
* @param arg Optional argument to pass to {@code pageFunction}
*/
@@ -1071,14 +992,12 @@ public interface Frame {
}
/**
* This method waits for an element matching {@code selector}, waits for [actionability](./actionability.md) checks, focuses the
* <p>
* element, fills it and triggers an {@code input} event after filling. If the element matching {@code selector} is not an {@code <input>},
* <p>
* {@code <textarea>} or {@code [contenteditable]} element, this method throws an error. Note that you can pass an empty string to
* <p>
* clear the input field.
* <p>
* To send fine-grained keyboard events, use [{@code method: Frame.type}].
*
* <p> To send fine-grained keyboard events, use [{@code method: Frame.type}].
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param value Value to fill for the {@code <input>}, {@code <textarea>} or {@code [contenteditable]} element.
@@ -1089,23 +1008,19 @@ public interface Frame {
}
/**
* This method fetches an element with {@code selector} and focuses it. If there's no element matching {@code selector}, the method
* <p>
* waits until a matching element appears in the DOM.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
void focus(String selector, FocusOptions options);
/**
* Returns the {@code frame} or {@code iframe} element handle which corresponds to this frame.
* <p>
* This is an inverse of [{@code method: ElementHandle.contentFrame}]. Note that returned handle actually belongs to the parent
* <p>
*
* <p> This is an inverse of [{@code method: ElementHandle.contentFrame}]. Note that returned handle actually belongs to the parent
* frame.
* <p>
* This method throws an error if the frame has been detached before {@code frameElement()} returns.
* <p>
*
* <p>
*
* <p> This method throws an error if the frame has been detached before {@code frameElement()} returns.
*/
ElementHandle frameElement();
default String getAttribute(String selector, String name) {
@@ -1113,6 +1028,7 @@ public interface Frame {
}
/**
* Returns element attribute value.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param name Attribute name to get the value for.
@@ -1123,34 +1039,24 @@ public interface Frame {
}
/**
* Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
* <p>
* last redirect.
* <p>
* {@code frame.goto} will throw an error if:
* <p>
*
* <p> {@code frame.goto} will throw an error if:
* - there's an SSL error (e.g. in case of self-signed certificates).
* <p>
* - target URL is invalid.
* <p>
* - the {@code timeout} is exceeded during navigation.
* <p>
* - the remote server does not respond or is unreachable.
* <p>
* - the main resource failed to load.
* <p>
* {@code frame.goto} will not throw an error when any valid HTTP status code is returned by the remote server, including 404
* <p>
*
* <p> {@code frame.goto} will not throw an error when any valid HTTP status code is returned by the remote server, including 404
* "Not Found" and 500 "Internal Server Error". The status code for such responses can be retrieved by calling
* <p>
* [{@code method: Response.status}].
* <p>
* > <strong>NOTE</strong> {@code frame.goto} either throws an error or returns a main resource response. The only exceptions are navigation
* <p>
*
* <p> > <strong>NOTE</strong> {@code frame.goto} either throws an error or returns a main resource response. The only exceptions are navigation
* to {@code about:blank} or navigation to the same URL with a different hash, which would succeed and return {@code null}.
* <p>
* > <strong>NOTE</strong> Headless mode doesn't support navigation to a PDF document. See the
* <p>
* [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295).
*
* @param url URL to navigate frame to. The url should include scheme, e.g. {@code https://}.
*/
Response navigate(String url, NavigateOptions options);
@@ -1159,22 +1065,16 @@ public interface Frame {
}
/**
* This method hovers over an element matching {@code selector} by performing the following steps:
* <p>
* 1. Find an element match matching {@code selector}. If there is none, wait until a matching element is attached to the DOM.
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the matched element, unless {@code force} option is set. If the
* <p>
* element is detached during the checks, the whole action is retried.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to hover over the center of the element, or the specified {@code position}.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -1184,6 +1084,7 @@ public interface Frame {
}
/**
* Returns {@code element.innerHTML}.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -1193,6 +1094,7 @@ public interface Frame {
}
/**
* Returns {@code element.innerText}.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -1203,11 +1105,10 @@ public interface Frame {
boolean isDetached();
/**
* Returns frame's name attribute as specified in the tag.
* <p>
* If the name is empty, returns the id attribute instead.
* <p>
* > <strong>NOTE</strong> This value is calculated once when the frame is created, and will not update if the attribute is changed
* <p>
*
* <p> If the name is empty, returns the id attribute instead.
*
* <p> > <strong>NOTE</strong> This value is calculated once when the frame is created, and will not update if the attribute is changed
* later.
*/
String name();
@@ -1224,26 +1125,22 @@ public interface Frame {
}
/**
* {@code key} can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
* <p>
* value or a single character to generate the text for. A superset of the {@code key} values can be found
* <p>
* [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
* <p>
* {@code F1} - {@code F12}, {@code Digit0}- {@code Digit9}, {@code KeyA}- {@code KeyZ}, {@code Backquote}, {@code Minus}, {@code Equal}, {@code Backslash}, {@code Backspace}, {@code Tab},
* <p>
*
* <p> {@code F1} - {@code F12}, {@code Digit0}- {@code Digit9}, {@code KeyA}- {@code KeyZ}, {@code Backquote}, {@code Minus}, {@code Equal}, {@code Backslash}, {@code Backspace}, {@code Tab},
* {@code Delete}, {@code Escape}, {@code ArrowDown}, {@code End}, {@code Enter}, {@code Home}, {@code Insert}, {@code PageDown}, {@code PageUp}, {@code ArrowRight}, {@code ArrowUp}, etc.
* <p>
* Following modification shortcuts are also supported: {@code Shift}, {@code Control}, {@code Alt}, {@code Meta}, {@code ShiftLeft}.
* <p>
* Holding down {@code Shift} will type the text that corresponds to the {@code key} in the upper case.
* <p>
* If {@code key} is a single character, it is case-sensitive, so the values {@code a} and {@code A} will generate different respective
* <p>
*
* <p> Following modification shortcuts are also supported: {@code Shift}, {@code Control}, {@code Alt}, {@code Meta}, {@code ShiftLeft}.
*
* <p> Holding down {@code Shift} will type the text that corresponds to the {@code key} in the upper case.
*
* <p> If {@code key} is a single character, it is case-sensitive, so the values {@code a} and {@code A} will generate different respective
* texts.
* <p>
* Shortcuts such as {@code key: "Control+o"} or {@code key: "Control+Shift+T"} are supported as well. When speficied with the
* <p>
*
* <p> Shortcuts such as {@code key: "Control+o"} or {@code key: "Control+Shift+T"} are supported as well. When speficied with the
* modifier, modifier is pressed and being held while the subsequent key is being pressed.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param key Name of the key to press or a character to generate, such as {@code ArrowLeft} or {@code a}.
@@ -1289,14 +1186,11 @@ public interface Frame {
}
/**
* Returns the array of option values that have been successfully selected.
* <p>
* Triggers a {@code change} and {@code input} event once all the provided options have been selected. If there's no {@code <select>} element
* <p>
*
* <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If there's no {@code <select>} element
* matching {@code selector}, the method throws an error.
* <p>
*
* <p>
*
*
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
* first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
@@ -1307,7 +1201,8 @@ public interface Frame {
setContent(html, null);
}
/**
*
*
*
* @param html HTML markup to assign to the page.
*/
void setContent(String html, SetContentOptions options);
@@ -1320,12 +1215,11 @@ public interface Frame {
default void setInputFiles(String selector, FileChooser.FilePayload[] files) { setInputFiles(selector, files, null); }
/**
* This method expects {@code selector} to point to an
* <p>
* [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
* <p>
* Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
* <p>
*
* <p> Sets the value of the file input to these file paths or files. If some of the {@code filePaths} are relative paths, then they
* are resolved relative to the the current working directory. For empty array, clears the selected files.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -1335,24 +1229,18 @@ public interface Frame {
}
/**
* This method taps an element matching {@code selector} by performing the following steps:
* <p>
* 1. Find an element match matching {@code selector}. If there is none, wait until a matching element is attached to the DOM.
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the matched element, unless {@code force} option is set. If the
* <p>
* element is detached during the checks, the whole action is retried.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.touchscreen}] to tap the center of the element, or the specified {@code position}.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
* <p>
* > <strong>NOTE</strong> {@code frame.tap()} requires that the {@code hasTouch} option of the browser context be set to true.
*
* <p> > <strong>NOTE</strong> {@code frame.tap()} requires that the {@code hasTouch} option of the browser context be set to true.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -1362,6 +1250,7 @@ public interface Frame {
}
/**
* Returns {@code element.textContent}.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -1375,14 +1264,11 @@ public interface Frame {
}
/**
* Sends a {@code keydown}, {@code keypress}/{@code input}, and {@code keyup} event for each character in the text. {@code frame.type} can be used to
* <p>
* send fine-grained keyboard events. To fill values in form fields, use [{@code method: Frame.fill}].
* <p>
* To press a special key, like {@code Control} or {@code ArrowDown}, use [{@code method: Keyboard.press}].
* <p>
*
* <p>
*
*
* <p> To press a special key, like {@code Control} or {@code ArrowDown}, use [{@code method: Keyboard.press}].
*
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
* @param text A text to type into a focused element.
@@ -1393,28 +1279,19 @@ public interface Frame {
}
/**
* This method checks an element matching {@code selector} by performing the following steps:
* <p>
* 1. Find an element match matching {@code selector}. If there is none, wait until a matching element is attached to the DOM.
* <p>
* 1. Ensure that matched element is a checkbox or a radio input. If not, this method rejects. If the element is already
* <p>
* unchecked, this method returns immediately.
* <p>
* 1. Wait for [actionability](./actionability.md) checks on the matched element, unless {@code force} option is set. If the
* <p>
* element is detached during the checks, the whole action is retried.
* <p>
* 1. Scroll the element into view if needed.
* <p>
* 1. Use [{@code property: Page.mouse}] to click in the center of the element.
* <p>
* 1. Wait for initiated navigations to either succeed or fail, unless {@code noWaitAfter} option is set.
* <p>
* 1. Ensure that the element is now unchecked. If not, this method rejects.
* <p>
* When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* <p>
*
* <p> When all steps combined have not finished during the specified {@code timeout}, this method rejects with a {@code TimeoutError}.
* Passing zero timeout disables this.
*
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See
* [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
@@ -1431,16 +1308,12 @@ public interface Frame {
}
/**
* Returns when the {@code pageFunction} returns a truthy value, returns that value.
* <p>
* The {@code waitForFunction} can be used to observe viewport size change:
* <p>
*
* <p>
* To pass an argument to the predicate of {@code frame.waitForFunction} function:
* <p>
*
* <p>
*
*
* <p> The {@code waitForFunction} can be used to observe viewport size change:
*
* <p> To pass an argument to the predicate of {@code frame.waitForFunction} function:
*
*
* @param pageFunction Function to be evaluated in browser context
* @param arg Optional argument to pass to {@code pageFunction}
*/
@@ -1453,14 +1326,11 @@ public interface Frame {
}
/**
* Waits for the required load state to be reached.
* <p>
* This returns when the frame reaches a required load state, {@code load} by default. The navigation must have been committed
* <p>
*
* <p> This returns when the frame reaches a required load state, {@code load} by default. The navigation must have been committed
* when this method is called. If current document has already reached the required state, resolves immediately.
* <p>
*
* <p>
*
*
*
* @param state Optional load state to wait for, defaults to {@code load}. If the state has been already reached while loading current
* document, the method returns immediately. Can be one of:
* - {@code 'load'} - wait for the {@code load} event to be fired.
@@ -1473,19 +1343,13 @@ public interface Frame {
}
/**
* Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
* <p>
* last redirect. In case of navigation to a different anchor or navigation due to History API usage, the navigation will
* <p>
* resolve with {@code null}.
* <p>
* This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause
* <p>
*
* <p> This method waits for the frame to navigate to a new URL. It is useful for when you run code which will indirectly cause
* the frame to navigate. Consider this example:
* <p>
*
* <p>
* <strong>NOTE</strong> Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
* <p>
*
* <p> <strong>NOTE</strong> Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is
* considered a navigation.
*/
Deferred<Response> futureNavigation(FutureNavigationOptions options);
@@ -1494,29 +1358,24 @@ public interface Frame {
}
/**
* Returns when element specified by selector satisfies {@code state} option. Returns {@code null} if waiting for {@code hidden} or
* <p>
* {@code detached}.
* <p>
* Wait for the {@code selector} to satisfy {@code state} option (either appear/disappear from dom, or become visible/hidden). If at
* <p>
*
* <p> Wait for the {@code selector} to satisfy {@code state} option (either appear/disappear from dom, or become visible/hidden). If at
* the moment of calling the method {@code selector} already satisfies the condition, the method will return immediately. If the
* <p>
* selector doesn't satisfy the condition for the {@code timeout} milliseconds, the function will throw.
* <p>
* This method works across navigations:
* <p>
*
* <p>
*
*
* <p> This method works across navigations:
*
*
* @param selector A selector to query for. See [working with selectors](./selectors.md#working-with-selectors) for more details.
*/
ElementHandle waitForSelector(String selector, WaitForSelectorOptions options);
/**
* Waits for the given {@code timeout} in milliseconds.
* <p>
* Note that {@code frame.waitForTimeout()} should only be used for debugging. Tests using the timer in production are going to
* <p>
*
* <p> Note that {@code frame.waitForTimeout()} should only be used for debugging. Tests using the timer in production are going to
* be flaky. Use signals such as network events, selectors becoming visible and others instead.
*
* @param timeout A timeout to wait for
*/
void waitForTimeout(double timeout);
@@ -20,19 +20,13 @@ import java.util.*;
/**
* JSHandle represents an in-page JavaScript object. JSHandles can be created with the [{@code method: Page.evaluateHandle}]
* <p>
* method.
* <p>
*
* <p>
* JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with
* <p>
*
* <p> JSHandle prevents the referenced JavaScript object being garbage collected unless the handle is exposed with
* [{@code method: JSHandle.dispose}]. JSHandles are auto-disposed when their origin frame gets navigated or the parent context
* <p>
* gets destroyed.
* <p>
* JSHandle instances can be used as an argument in [{@code method: Page.$eval}], [{@code method: Page.evaluate}] and
* <p>
*
* <p> JSHandle instances can be used as an argument in [{@code method: Page.$eval}], [{@code method: Page.evaluate}] and
* [{@code method: Page.evaluateHandle}] methods.
*/
public interface JSHandle {
@@ -49,18 +43,13 @@ public interface JSHandle {
}
/**
* Returns the return value of {@code pageFunction}
* <p>
* This method passes this handle as the first argument to {@code pageFunction}.
* <p>
* If {@code pageFunction} returns a [Promise], then {@code handle.evaluate} would wait for the promise to resolve and return its
* <p>
*
* <p> This method passes this handle as the first argument to {@code pageFunction}.
*
* <p> If {@code pageFunction} returns a [Promise], then {@code handle.evaluate} would wait for the promise to resolve and return its
* value.
* <p>
* Examples:
* <p>
*
* <p>
*
*
*
* @param pageFunction Function to be evaluated in browser context
* @param arg Optional argument to pass to {@code pageFunction}
*/
@@ -70,39 +59,35 @@ public interface JSHandle {
}
/**
* Returns the return value of {@code pageFunction} as in-page object (JSHandle).
* <p>
* This method passes this handle as the first argument to {@code pageFunction}.
* <p>
* The only difference between {@code jsHandle.evaluate} and {@code jsHandle.evaluateHandle} is that {@code jsHandle.evaluateHandle} returns
* <p>
*
* <p> This method passes this handle as the first argument to {@code pageFunction}.
*
* <p> The only difference between {@code jsHandle.evaluate} and {@code jsHandle.evaluateHandle} is that {@code jsHandle.evaluateHandle} returns
* in-page object (JSHandle).
* <p>
* If the function passed to the {@code jsHandle.evaluateHandle} returns a [Promise], then {@code jsHandle.evaluateHandle} would wait
* <p>
*
* <p> If the function passed to the {@code jsHandle.evaluateHandle} returns a [Promise], then {@code jsHandle.evaluateHandle} would wait
* for the promise to resolve and return its value.
* <p>
* See [{@code method: Page.evaluateHandle}] for more details.
*
* <p> See [{@code method: Page.evaluateHandle}] for more details.
*
* @param pageFunction Function to be evaluated
* @param arg Optional argument to pass to {@code pageFunction}
*/
JSHandle evaluateHandle(String pageFunction, Object arg);
/**
* The method returns a map with **own property names** as keys and JSHandle instances for the property values.
* <p>
*
* <p>
*/
Map<String, JSHandle> getProperties();
/**
* Fetches a single property from the referenced object.
*
* @param propertyName property to get
*/
JSHandle getProperty(String propertyName);
/**
* Returns a JSON representation of the object. If the object has a {@code toJSON} function, it **will not be called**.
* <p>
* > <strong>NOTE</strong> The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an
* <p>
*
* <p> > <strong>NOTE</strong> The method will return an empty JSON object if the referenced object is not stringifiable. It will throw an
* error if the object has circular references.
*/
Object jsonValue();
@@ -20,66 +20,50 @@ import java.util.*;
/**
* Keyboard provides an api for managing a virtual keyboard. The high level api is [{@code method: Keyboard.type}], which takes
* <p>
* raw characters and generates proper keydown, keypress/input, and keyup events on your page.
* <p>
* For finer control, you can use [{@code method: Keyboard.down}], [{@code method: Keyboard.up}], and [{@code method: Keyboard.insertText}]
* <p>
*
* <p> For finer control, you can use [{@code method: Keyboard.down}], [{@code method: Keyboard.up}], and [{@code method: Keyboard.insertText}]
* to manually fire events as if they were generated from a real keyboard.
* <p>
*
* <p>
*
* <p>
* An example to trigger select-all with the keyboard
* <p>
*
* <p>
*
* <p> An example to trigger select-all with the keyboard
*/
public interface Keyboard {
enum Modifier { ALT, CONTROL, META, SHIFT }
/**
* Dispatches a {@code keydown} event.
* <p>
* {@code key} can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
* <p>
*
* <p> {@code key} can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
* value or a single character to generate the text for. A superset of the {@code key} values can be found
* <p>
* [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
* <p>
* {@code F1} - {@code F12}, {@code Digit0}- {@code Digit9}, {@code KeyA}- {@code KeyZ}, {@code Backquote}, {@code Minus}, {@code Equal}, {@code Backslash}, {@code Backspace}, {@code Tab},
* <p>
*
* <p> {@code F1} - {@code F12}, {@code Digit0}- {@code Digit9}, {@code KeyA}- {@code KeyZ}, {@code Backquote}, {@code Minus}, {@code Equal}, {@code Backslash}, {@code Backspace}, {@code Tab},
* {@code Delete}, {@code Escape}, {@code ArrowDown}, {@code End}, {@code Enter}, {@code Home}, {@code Insert}, {@code PageDown}, {@code PageUp}, {@code ArrowRight}, {@code ArrowUp}, etc.
* <p>
* Following modification shortcuts are also supported: {@code Shift}, {@code Control}, {@code Alt}, {@code Meta}, {@code ShiftLeft}.
* <p>
* Holding down {@code Shift} will type the text that corresponds to the {@code key} in the upper case.
* <p>
* If {@code key} is a single character, it is case-sensitive, so the values {@code a} and {@code A} will generate different respective
* <p>
*
* <p> Following modification shortcuts are also supported: {@code Shift}, {@code Control}, {@code Alt}, {@code Meta}, {@code ShiftLeft}.
*
* <p> Holding down {@code Shift} will type the text that corresponds to the {@code key} in the upper case.
*
* <p> If {@code key} is a single character, it is case-sensitive, so the values {@code a} and {@code A} will generate different respective
* texts.
* <p>
* If {@code key} is a modifier key, {@code Shift}, {@code Meta}, {@code Control}, or {@code Alt}, subsequent key presses will be sent with that modifier
* <p>
*
* <p> If {@code key} is a modifier key, {@code Shift}, {@code Meta}, {@code Control}, or {@code Alt}, subsequent key presses will be sent with that modifier
* active. To release the modifier key, use [{@code method: Keyboard.up}].
* <p>
* After the key is pressed once, subsequent calls to [{@code method: Keyboard.down}] will have
* <p>
*
* <p> After the key is pressed once, subsequent calls to [{@code method: Keyboard.down}] will have
* [repeat](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use
* <p>
* [{@code method: Keyboard.up}].
* <p>
* > <strong>NOTE</strong> Modifier keys DO influence {@code keyboard.down}. Holding down {@code Shift} will type the text in upper case.
*
* <p> > <strong>NOTE</strong> Modifier keys DO influence {@code keyboard.down}. Holding down {@code Shift} will type the text in upper case.
*
* @param key Name of the key to press or a character to generate, such as {@code ArrowLeft} or {@code a}.
*/
void down(String key);
/**
* Dispatches only {@code input} event, does not emit the {@code keydown}, {@code keyup} or {@code keypress} events.
* <p>
*
* <p>
* > <strong>NOTE</strong> Modifier keys DO NOT effect {@code keyboard.insertText}. Holding down {@code Shift} will not type the text in upper case.
*
* <p> > <strong>NOTE</strong> Modifier keys DO NOT effect {@code keyboard.insertText}. Holding down {@code Shift} will not type the text in upper case.
*
* @param text Sets input to the specified text value.
*/
void insertText(String text);
@@ -88,30 +72,24 @@ public interface Keyboard {
}
/**
* {@code key} can specify the intended [keyboardEvent.key](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key)
* <p>
* value or a single character to generate the text for. A superset of the {@code key} values can be found
* <p>
* [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:
* <p>
* {@code F1} - {@code F12}, {@code Digit0}- {@code Digit9}, {@code KeyA}- {@code KeyZ}, {@code Backquote}, {@code Minus}, {@code Equal}, {@code Backslash}, {@code Backspace}, {@code Tab},
* <p>
*
* <p> {@code F1} - {@code F12}, {@code Digit0}- {@code Digit9}, {@code KeyA}- {@code KeyZ}, {@code Backquote}, {@code Minus}, {@code Equal}, {@code Backslash}, {@code Backspace}, {@code Tab},
* {@code Delete}, {@code Escape}, {@code ArrowDown}, {@code End}, {@code Enter}, {@code Home}, {@code Insert}, {@code PageDown}, {@code PageUp}, {@code ArrowRight}, {@code ArrowUp}, etc.
* <p>
* Following modification shortcuts are also supported: {@code Shift}, {@code Control}, {@code Alt}, {@code Meta}, {@code ShiftLeft}.
* <p>
* Holding down {@code Shift} will type the text that corresponds to the {@code key} in the upper case.
* <p>
* If {@code key} is a single character, it is case-sensitive, so the values {@code a} and {@code A} will generate different respective
* <p>
*
* <p> Following modification shortcuts are also supported: {@code Shift}, {@code Control}, {@code Alt}, {@code Meta}, {@code ShiftLeft}.
*
* <p> Holding down {@code Shift} will type the text that corresponds to the {@code key} in the upper case.
*
* <p> If {@code key} is a single character, it is case-sensitive, so the values {@code a} and {@code A} will generate different respective
* texts.
* <p>
* Shortcuts such as {@code key: "Control+o"} or {@code key: "Control+Shift+T"} are supported as well. When speficied with the
* <p>
*
* <p> Shortcuts such as {@code key: "Control+o"} or {@code key: "Control+Shift+T"} are supported as well. When speficied with the
* modifier, modifier is pressed and being held while the subsequent key is being pressed.
* <p>
*
* <p>
* Shortcut for [{@code method: Keyboard.down}] and [{@code method: Keyboard.up}].
*
* <p> Shortcut for [{@code method: Keyboard.down}] and [{@code method: Keyboard.up}].
*
* @param key Name of the key to press or a character to generate, such as {@code ArrowLeft} or {@code a}.
*/
void press(String key, int delay);
@@ -120,17 +98,17 @@ public interface Keyboard {
}
/**
* Sends a {@code keydown}, {@code keypress}/{@code input}, and {@code keyup} event for each character in the text.
* <p>
* To press a special key, like {@code Control} or {@code ArrowDown}, use [{@code method: Keyboard.press}].
* <p>
*
* <p>
* > <strong>NOTE</strong> Modifier keys DO NOT effect {@code keyboard.type}. Holding down {@code Shift} will not type the text in upper case.
*
* <p> To press a special key, like {@code Control} or {@code ArrowDown}, use [{@code method: Keyboard.press}].
*
* <p> > <strong>NOTE</strong> Modifier keys DO NOT effect {@code keyboard.type}. Holding down {@code Shift} will not type the text in upper case.
*
* @param text A text to type into a focused element.
*/
void type(String text, int delay);
/**
* Dispatches a {@code keyup} event.
*
* @param key Name of the key to press or a character to generate, such as {@code ArrowLeft} or {@code a}.
*/
void up(String key);
@@ -20,11 +20,8 @@ import java.util.*;
/**
* The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
* <p>
* Every {@code page} object has its own Mouse, accessible with [{@code property: Page.mouse}].
* <p>
*
* <p>
*
* <p> Every {@code page} object has its own Mouse, accessible with [{@code property: Page.mouse}].
*/
public interface Mouse {
enum Button { LEFT, MIDDLE, RIGHT }
@@ -136,7 +133,6 @@ public interface Mouse {
}
/**
* Shortcut for [{@code method: Mouse.move}], [{@code method: Mouse.down}], [{@code method: Mouse.up}], [{@code method: Mouse.down}] and
* <p>
* [{@code method: Mouse.up}].
*/
void dblclick(double x, double y, DblclickOptions options);
File diff suppressed because it is too large Load Diff
@@ -21,13 +21,9 @@ import java.util.*;
/**
* Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright
* <p>
* to drive automation:
* <p>
*
* <p>
* By default, the {@code playwright} NPM package automatically downloads browser executables during installation. The
* <p>
*
* <p> By default, the {@code playwright} NPM package automatically downloads browser executables during installation. The
* {@code playwright-core} NPM package can be used to skip automatic downloads.
*/
public interface Playwright {
@@ -37,13 +33,8 @@ public interface Playwright {
BrowserType chromium();
/**
* Returns a list of devices to be used with [{@code method: Browser.newContext}] or [{@code method: Browser.newPage}]. Actual list of
* <p>
* devices can be found in
* <p>
* [src/server/deviceDescriptors.ts](https://github.com/Microsoft/playwright/blob/master/src/server/deviceDescriptors.ts).
* <p>
*
* <p>
*/
Map<String, DeviceDescriptor> devices();
/**
@@ -52,7 +43,6 @@ public interface Playwright {
BrowserType firefox();
/**
* Selectors can be used to install custom selector engines. See
* <p>
* [Working with selectors](./selectors.md#working-with-selectors) for more information.
*/
Selectors selectors();
@@ -20,23 +20,17 @@ import java.util.*;
/**
* Whenever the page sends a request for a network resource the following sequence of events are emitted by {@code Page}:
* <p>
* - [{@code event: Page.request}] emitted when the request is issued by the page.
* <p>
* - [{@code event: Page.response}] emitted when/if the response status and headers are received for the request.
* <p>
* - [{@code event: Page.requestfinished}] emitted when the response body is downloaded and the request is complete.
* <p>
* If request fails at some point, then instead of {@code 'requestfinished'} event (and possibly instead of 'response' event),
* <p>
*
* <p> If request fails at some point, then instead of {@code 'requestfinished'} event (and possibly instead of 'response' event),
* the [{@code event: Page.requestfailed}] event is emitted.
* <p>
* > <strong>NOTE</strong> HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request
* <p>
*
* <p> > <strong>NOTE</strong> HTTP Error responses, such as 404 or 503, are still successful responses from HTTP standpoint, so request
* will complete with {@code 'requestfinished'} event.
* <p>
* If request gets a 'redirect' response, the request is successfully finished with the 'requestfinished' event, and a new
* <p>
*
* <p> If request gets a 'redirect' response, the request is successfully finished with the 'requestfinished' event, and a new
* request is issued to a redirected url.
*/
public interface Request {
@@ -129,11 +123,8 @@ public interface Request {
}
/**
* The method returns {@code null} unless this request has failed, as reported by {@code requestfailed} event.
* <p>
* Example of logging of all the failed requests:
* <p>
*
* <p>
*
* <p> Example of logging of all the failed requests:
*/
RequestFailure failure();
/**
@@ -162,37 +153,25 @@ public interface Request {
byte[] postDataBuffer();
/**
* Request that was redirected by the server to this one, if any.
* <p>
* When the server responds with a redirect, Playwright creates a new {@code Request} object. The two requests are connected by
* <p>
*
* <p> When the server responds with a redirect, Playwright creates a new {@code Request} object. The two requests are connected by
* {@code redirectedFrom()} and {@code redirectedTo()} methods. When multiple server redirects has happened, it is possible to
* <p>
* construct the whole redirect chain by repeatedly calling {@code redirectedFrom()}.
* <p>
* For example, if the website {@code http://example.com} redirects to {@code https://example.com}:
* <p>
*
* <p>
* If the website {@code https://google.com} has no redirects:
* <p>
*
* <p>
*
* <p> For example, if the website {@code http://example.com} redirects to {@code https://example.com}:
*
* <p> If the website {@code https://google.com} has no redirects:
*/
Request redirectedFrom();
/**
* New request issued by the browser if the server responded with redirect.
* <p>
* This method is the opposite of [{@code method: Request.redirectedFrom}]:
* <p>
*
* <p>
*
* <p> This method is the opposite of [{@code method: Request.redirectedFrom}]:
*/
Request redirectedTo();
/**
* Contains the request's resource type as it was perceived by the rendering engine. ResourceType will be one of the
* <p>
* following: {@code document}, {@code stylesheet}, {@code image}, {@code media}, {@code font}, {@code script}, {@code texttrack}, {@code xhr}, {@code fetch}, {@code eventsource},
* <p>
* {@code websocket}, {@code manifest}, {@code other}.
*/
String resourceType();
@@ -202,13 +181,8 @@ public interface Request {
Response response();
/**
* Returns resource timing information for given request. Most of the timing values become available upon the response,
* <p>
* {@code responseEnd} becomes available when request finishes. Find more information at
* <p>
* [Resource Timing API](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming).
* <p>
*
* <p>
*/
RequestTiming timing();
/**
@@ -22,7 +22,6 @@ import java.util.*;
/**
* Whenever a network route is set up with [{@code method: Page.route}] or [{@code method: BrowserContext.route}], the {@code Route} object
* <p>
* allows to handle the route.
*/
public interface Route {
@@ -119,6 +118,7 @@ public interface Route {
}
/**
* Aborts the route's request.
*
* @param errorCode Optional error code. Defaults to {@code failed}, could be one of the following:
* - {@code 'aborted'} - An operation was aborted (due to user action)
* - {@code 'accessdenied'} - Permission to access a resource, other than the network, was denied
@@ -143,21 +143,15 @@ public interface Route {
}
/**
* Continues route's request with optional overrides.
* <p>
*
* <p>
*
*
*
* @param overrides Optional request overrides, can override following properties:
*/
void continue_(ContinueOverrides overrides);
/**
* Fulfills route's request with given response.
* <p>
*
* <p>
*
* <p>
*
*
*
* @param response Response that will fulfill this route's request.
*/
void fulfill(FulfillResponse response);
@@ -21,7 +21,6 @@ import java.util.*;
/**
* Selectors can be used to install custom selector engines. See
* <p>
* [Working with selectors](./selectors.md#working-with-selectors) for more information.
*/
public interface Selectors {
@@ -43,10 +42,8 @@ public interface Selectors {
default void register(String name, Path path) { register(name, path, null); }
/**
* An example of registering selector engine that queries elements based on a tag name:
* <p>
*
* <p>
*
*
*
* @param name Name that is used in selectors as a prefix, e.g. {@code {name: 'foo'}} enables {@code foo=myselectorbody} selectors. May only
* contain {@code [a-zA-Z0-9_]} characters.
* @param script Script that evaluates to a selector engine instance.
@@ -20,9 +20,8 @@ import java.util.*;
/**
* - extends: [Error]
* <p>
* TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [{@code method: Page.waitForSelector}]
* <p>
*
* <p> TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. [{@code method: Page.waitForSelector}]
* or [{@code method: BrowserType.launch}].
*/
public interface TimeoutError {
@@ -20,7 +20,6 @@ import java.util.*;
/**
* The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the
* <p>
* touchscreen can only be used in browser contexts that have been intialized with {@code hasTouch} set to true.
*/
public interface Touchscreen {
@@ -21,14 +21,10 @@ import java.util.*;
/**
* When browser context is created with the {@code videosPath} option, each page has a video object associated with it.
* <p>
*
* <p>
*/
public interface Video {
/**
* Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem
* <p>
* upon closing the browser context.
*/
Path path();
@@ -68,10 +68,10 @@ public interface WebSocket {
}
/**
* Returns the event data value.
* <p>
* Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy
* <p>
*
* <p> 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 webSocket is closed before the event is fired.
*
* @param event Event name, same one would pass into {@code webSocket.on(event)}.
*/
Deferred<Event<EventType>> futureEvent(EventType event, FutureEventOptions options);
@@ -20,13 +20,8 @@ import java.util.*;
/**
* The Worker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). {@code worker}
* <p>
* event is emitted on the page object to signal a worker creation. {@code close} event is emitted on the worker object when the
* <p>
* worker is gone.
* <p>
*
* <p>
*/
public interface Worker {
enum EventType {
@@ -40,16 +35,14 @@ public interface Worker {
}
/**
* Returns the return value of {@code pageFunction}
* <p>
* If the function passed to the {@code worker.evaluate} returns a [Promise], then {@code worker.evaluate} would wait for the promise
* <p>
*
* <p> If the function passed to the {@code worker.evaluate} returns a [Promise], then {@code worker.evaluate} would wait for the promise
* to resolve and return its value.
* <p>
* If the function passed to the {@code worker.evaluate} returns a non-[Serializable] value, then {@code worker.evaluate} returns
* <p>
*
* <p> If the function passed to the {@code worker.evaluate} returns a non-[Serializable] value, then {@code worker.evaluate} returns
* {@code undefined}. DevTools Protocol also supports transferring some additional values that are not serializable by {@code JSON}:
* <p>
* {@code -0}, {@code NaN}, {@code Infinity}, {@code -Infinity}, and bigint literals.
*
* @param pageFunction Function to be evaluated in the worker context
* @param arg Optional argument to pass to {@code pageFunction}
*/
@@ -59,14 +52,13 @@ public interface Worker {
}
/**
* Returns the return value of {@code pageFunction} as in-page object (JSHandle).
* <p>
* The only difference between {@code worker.evaluate} and {@code worker.evaluateHandle} is that {@code worker.evaluateHandle} returns
* <p>
*
* <p> The only difference between {@code worker.evaluate} and {@code worker.evaluateHandle} is that {@code worker.evaluateHandle} returns
* in-page object (JSHandle).
* <p>
* If the function passed to the {@code worker.evaluateHandle} returns a [Promise], then {@code worker.evaluateHandle} would wait for
* <p>
*
* <p> If the function passed to the {@code worker.evaluateHandle} returns a [Promise], then {@code worker.evaluateHandle} would wait for
* the promise to resolve and return its value.
*
* @param pageFunction Function to be evaluated in the page context
* @param arg Optional argument to pass to {@code pageFunction}
*/
@@ -68,7 +68,7 @@ abstract class Element {
output.add(offset + "/**");
String[] lines = text.split("\\n");
for (String line : lines) {
output.add(offset + " * " + line
output.add((offset + " *" + (line.isEmpty() ? "" : " ") + line)
.replace("*/", "*\\/")
.replace("**NOTE**", "<strong>NOTE</strong>")
.replaceAll("`([^`]+)`", "{@code $1}"));
@@ -79,12 +79,14 @@ abstract class Element {
String formattedComment() {
return comment()
// Remove any code snippets between ``` and ```.
.replaceAll("```((?<!`)`(?!`)|[^`])+```", "")
.replaceAll("\\n```((?<!`)`(?!`)|[^`])+```\\n", "")
.replaceAll("\\nAn example of[^\\n]+\\n", "")
.replaceAll("\\nThis example [^\\n]+\\n", "")
.replaceAll("\\nExamples:\\n", "")
.replaceAll("\\nSee ChromiumBrowser[^\\n]+", "\n")
.replaceAll("\\n\\n", "\n")
.replaceAll("\\n", "\n<p>\n");
// > **NOTE** ... => **NOTE** ...
.replaceAll("^>", "")
.replaceAll("\\n\\n", "\n\n<p> ");
}
String comment() {
@@ -622,6 +624,7 @@ class Method extends Element {
}
List<String> sections = new ArrayList<>();
sections.add(formattedComment());
boolean hasBlankLine = false;
if (!params.isEmpty()) {
for (Param p : params) {
String comment = p.comment();
@@ -631,10 +634,18 @@ class Method extends Element {
if (skipJavadoc.contains(p.jsonPath)) {
continue;
}
if (!hasBlankLine) {
sections.add("");
hasBlankLine = true;
}
sections.add("@param " + p.name() + " " + comment);
}
}
if (jsonElement.getAsJsonObject().has("returnComment")) {
if (!hasBlankLine) {
sections.add("");
hasBlankLine = true;
}
String returnComment = jsonElement.getAsJsonObject().get("returnComment").getAsString();
sections.add("@return " + returnComment);
}