From d9fea34baa2d0aa8cf0bc77b66707f47468ee3af Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Wed, 21 Dec 2022 10:15:51 -0800 Subject: [PATCH] feat: generate @since tags for methods (#1145) --- .../com/microsoft/playwright/APIRequest.java | 4 + .../playwright/APIRequestContext.java | 22 ++ .../com/microsoft/playwright/APIResponse.java | 18 ++ .../com/microsoft/playwright/Browser.java | 24 ++ .../microsoft/playwright/BrowserContext.java | 58 ++++ .../com/microsoft/playwright/BrowserType.java | 14 + .../microsoft/playwright/ConsoleMessage.java | 8 + .../java/com/microsoft/playwright/Dialog.java | 11 + .../com/microsoft/playwright/Download.java | 17 ++ .../microsoft/playwright/ElementHandle.java | 115 ++++++++ .../com/microsoft/playwright/FileChooser.java | 22 ++ .../java/com/microsoft/playwright/Frame.java | 159 ++++++++++ .../microsoft/playwright/FrameLocator.java | 33 +++ .../com/microsoft/playwright/JSHandle.java | 13 + .../com/microsoft/playwright/Keyboard.java | 7 + .../com/microsoft/playwright/Locator.java | 202 +++++++++++++ .../java/com/microsoft/playwright/Mouse.java | 21 ++ .../java/com/microsoft/playwright/Page.java | 272 ++++++++++++++++++ .../com/microsoft/playwright/Playwright.java | 14 + .../com/microsoft/playwright/Request.java | 33 +++ .../com/microsoft/playwright/Response.java | 32 +++ .../java/com/microsoft/playwright/Route.java | 21 ++ .../com/microsoft/playwright/Selectors.java | 5 + .../com/microsoft/playwright/Touchscreen.java | 2 + .../com/microsoft/playwright/Tracing.java | 16 ++ .../java/com/microsoft/playwright/Video.java | 5 + .../com/microsoft/playwright/WebSocket.java | 8 + .../microsoft/playwright/WebSocketFrame.java | 4 + .../java/com/microsoft/playwright/Worker.java | 11 + .../assertions/APIResponseAssertions.java | 4 + .../assertions/LocatorAssertions.java | 82 ++++++ .../playwright/assertions/PageAssertions.java | 10 + .../assertions/PlaywrightAssertions.java | 4 + .../playwright/options/FormData.java | 7 + .../playwright/options/RequestOptions.java | 16 ++ .../com/microsoft/playwright/TestClick.java | 1 + .../playwright/tools/ApiGenerator.java | 8 + 37 files changed, 1303 insertions(+) diff --git a/playwright/src/main/java/com/microsoft/playwright/APIRequest.java b/playwright/src/main/java/com/microsoft/playwright/APIRequest.java index 4978ac23..88722473 100644 --- a/playwright/src/main/java/com/microsoft/playwright/APIRequest.java +++ b/playwright/src/main/java/com/microsoft/playwright/APIRequest.java @@ -176,12 +176,16 @@ public interface APIRequest { } /** * Creates new instances of {@code APIRequestContext}. + * + * @since v1.16 */ default APIRequestContext newContext() { return newContext(null); } /** * Creates new instances of {@code APIRequestContext}. + * + * @since v1.16 */ APIRequestContext newContext(NewContextOptions options); } diff --git a/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java b/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java index 9be09adf..8e173b05 100644 --- a/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java @@ -63,6 +63,7 @@ public interface APIRequestContext { * The method will automatically follow redirects. * * @param url Target URL. + * @since v1.16 */ default APIResponse delete(String url) { return delete(url, null); @@ -74,12 +75,15 @@ public interface APIRequestContext { * * @param url Target URL. * @param params Optional request parameters. + * @since v1.16 */ APIResponse delete(String url, RequestOptions params); /** * All responses returned by {@link APIRequestContext#get APIRequestContext.get()} and similar methods are stored in the * memory, so that you can later call {@link APIResponse#body APIResponse.body()}. This method discards all stored * responses, and makes {@link APIResponse#body APIResponse.body()} throw "Response disposed" error. + * + * @since v1.16 */ void dispose(); /** @@ -113,6 +117,7 @@ public interface APIRequestContext { * } * * @param urlOrRequest Target URL or Request to get all parameters from. + * @since v1.16 */ default APIResponse fetch(String urlOrRequest) { return fetch(urlOrRequest, null); @@ -149,6 +154,7 @@ public interface APIRequestContext { * * @param urlOrRequest Target URL or Request to get all parameters from. * @param params Optional request parameters. + * @since v1.16 */ APIResponse fetch(String urlOrRequest, RequestOptions params); /** @@ -182,6 +188,7 @@ public interface APIRequestContext { * } * * @param urlOrRequest Target URL or Request to get all parameters from. + * @since v1.16 */ default APIResponse fetch(Request urlOrRequest) { return fetch(urlOrRequest, null); @@ -218,6 +225,7 @@ public interface APIRequestContext { * * @param urlOrRequest Target URL or Request to get all parameters from. * @param params Optional request parameters. + * @since v1.16 */ APIResponse fetch(Request urlOrRequest, RequestOptions params); /** @@ -235,6 +243,7 @@ public interface APIRequestContext { * } * * @param url Target URL. + * @since v1.16 */ default APIResponse get(String url) { return get(url, null); @@ -255,6 +264,7 @@ public interface APIRequestContext { * * @param url Target URL. * @param params Optional request parameters. + * @since v1.16 */ APIResponse get(String url, RequestOptions params); /** @@ -263,6 +273,7 @@ public interface APIRequestContext { * method will automatically follow redirects. * * @param url Target URL. + * @since v1.16 */ default APIResponse head(String url) { return head(url, null); @@ -274,6 +285,7 @@ public interface APIRequestContext { * * @param url Target URL. * @param params Optional request parameters. + * @since v1.16 */ APIResponse head(String url, RequestOptions params); /** @@ -282,6 +294,7 @@ public interface APIRequestContext { * The method will automatically follow redirects. * * @param url Target URL. + * @since v1.16 */ default APIResponse patch(String url) { return patch(url, null); @@ -293,6 +306,7 @@ public interface APIRequestContext { * * @param url Target URL. * @param params Optional request parameters. + * @since v1.16 */ APIResponse patch(String url, RequestOptions params); /** @@ -337,6 +351,7 @@ public interface APIRequestContext { * } * * @param url Target URL. + * @since v1.16 */ default APIResponse post(String url) { return post(url, null); @@ -384,6 +399,7 @@ public interface APIRequestContext { * * @param url Target URL. * @param params Optional request parameters. + * @since v1.16 */ APIResponse post(String url, RequestOptions params); /** @@ -392,6 +408,7 @@ public interface APIRequestContext { * method will automatically follow redirects. * * @param url Target URL. + * @since v1.16 */ default APIResponse put(String url) { return put(url, null); @@ -403,11 +420,14 @@ public interface APIRequestContext { * * @param url Target URL. * @param params Optional request parameters. + * @since v1.16 */ APIResponse put(String url, RequestOptions params); /** * Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to * the constructor. + * + * @since v1.16 */ default String storageState() { return storageState(null); @@ -415,6 +435,8 @@ public interface APIRequestContext { /** * Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to * the constructor. + * + * @since v1.16 */ String storageState(StorageStateOptions options); } diff --git a/playwright/src/main/java/com/microsoft/playwright/APIResponse.java b/playwright/src/main/java/com/microsoft/playwright/APIResponse.java index 7a6077f3..7bdf52e0 100644 --- a/playwright/src/main/java/com/microsoft/playwright/APIResponse.java +++ b/playwright/src/main/java/com/microsoft/playwright/APIResponse.java @@ -26,39 +26,57 @@ import java.util.*; public interface APIResponse { /** * Returns the buffer with response body. + * + * @since v1.16 */ byte[] body(); /** * Disposes the body of this response. If not called then the body will stay in memory until the context closes. + * + * @since v1.16 */ void dispose(); /** * An object with all the response HTTP headers associated with this response. + * + * @since v1.16 */ Map headers(); /** * An array with all the request HTTP headers associated with this response. Header names are not lower-cased. Headers with * multiple entries, such as {@code Set-Cookie}, appear in the array multiple times. + * + * @since v1.16 */ List headersArray(); /** * Contains a boolean stating whether the response was successful (status in the range 200-299) or not. + * + * @since v1.16 */ boolean ok(); /** * Contains the status code of the response (e.g., 200 for a success). + * + * @since v1.16 */ int status(); /** * Contains the status text of the response (e.g. usually an "OK" for a success). + * + * @since v1.16 */ String statusText(); /** * Returns the text representation of response body. + * + * @since v1.16 */ String text(); /** * Contains the URL of the response. + * + * @since v1.16 */ String url(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java index 6378428d..e5086b2b 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Browser.java +++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java @@ -1084,6 +1084,8 @@ public interface Browser extends AutoCloseable { } /** * Get the browser type (chromium, firefox or webkit) that the browser belongs to. + * + * @since v1.23 */ BrowserType browserType(); /** @@ -1098,6 +1100,8 @@ public interface Browser extends AutoCloseable { * Browser.newContext()} **before** calling {@link Browser#close Browser.close()}. * *

The {@code Browser} object itself is considered to be disposed and cannot be used anymore. + * + * @since v1.8 */ void close(); /** @@ -1110,10 +1114,14 @@ public interface Browser extends AutoCloseable { * BrowserContext context = browser.newContext(); * System.out.println(browser.contexts().size()); // prints "1" * } + * + * @since v1.8 */ List contexts(); /** * Indicates that the browser is connected. + * + * @since v1.8 */ boolean isConnected(); /** @@ -1137,6 +1145,8 @@ public interface Browser extends AutoCloseable { * context.close(); * browser.close(); * } + * + * @since v1.8 */ default BrowserContext newContext() { return newContext(null); @@ -1162,6 +1172,8 @@ public interface Browser extends AutoCloseable { * context.close(); * browser.close(); * } + * + * @since v1.8 */ BrowserContext newContext(NewContextOptions options); /** @@ -1170,6 +1182,8 @@ public interface Browser extends AutoCloseable { *

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 {@link Browser#newContext Browser.newContext()} followed by the {@link * BrowserContext#newPage BrowserContext.newPage()} to control their exact life times. + * + * @since v1.8 */ default Page newPage() { return newPage(null); @@ -1180,6 +1194,8 @@ public interface Browser extends AutoCloseable { *

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 {@link Browser#newContext Browser.newContext()} followed by the {@link * BrowserContext#newPage BrowserContext.newPage()} to control their exact life times. + * + * @since v1.8 */ Page newPage(NewPageOptions options); /** @@ -1200,6 +1216,7 @@ public interface Browser extends AutoCloseable { * } * * @param page Optional, if specified, tracing includes screenshots of the given page. + * @since v1.11 */ default void startTracing(Page page) { startTracing(page, null); @@ -1220,6 +1237,8 @@ public interface Browser extends AutoCloseable { * page.goto('https://www.google.com'); * browser.stopTracing(); * } + * + * @since v1.11 */ default void startTracing() { startTracing(null); @@ -1242,6 +1261,7 @@ public interface Browser extends AutoCloseable { * } * * @param page Optional, if specified, tracing includes screenshots of the given page. + * @since v1.11 */ void startTracing(Page page, StartTracingOptions options); /** @@ -1251,10 +1271,14 @@ public interface Browser extends AutoCloseable { * href="https://playwright.dev/java/docs/api/class-tracing">here. * *

Returns the buffer with trace data. + * + * @since v1.11 */ byte[] stopTracing(); /** * Returns the browser version. + * + * @since v1.8 */ String version(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java index 06b9bc29..675b2236 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java @@ -283,6 +283,8 @@ public interface BrowserContext extends AutoCloseable { *

{@code
    * browserContext.addCookies(Arrays.asList(cookieObject1, cookieObject2));
    * }
+ * + * @since v1.8 */ void addCookies(List cookies); /** @@ -308,6 +310,7 @@ public interface BrowserContext extends AutoCloseable { * BrowserContext.addInitScript()} and {@link Page#addInitScript Page.addInitScript()} is not defined. * * @param script Script to be evaluated in all pages in the browser context. + * @since v1.8 */ void addInitScript(String script); /** @@ -333,14 +336,19 @@ public interface BrowserContext extends AutoCloseable { * BrowserContext.addInitScript()} and {@link Page#addInitScript Page.addInitScript()} is not defined. * * @param script Script to be evaluated in all pages in the browser context. + * @since v1.8 */ void addInitScript(Path script); /** * Returns the browser instance of the context. If it was launched as a persistent context null gets returned. + * + * @since v1.8 */ Browser browser(); /** * Clears context cookies. + * + * @since v1.8 */ void clearCookies(); /** @@ -353,17 +361,23 @@ public interface BrowserContext extends AutoCloseable { * // do stuff .. * context.clearPermissions(); * } + * + * @since v1.8 */ void clearPermissions(); /** * Closes the browser context. All the pages that belong to the browser context will be closed. * *

NOTE: The default browser context cannot be closed. + * + * @since v1.8 */ void close(); /** * If no URLs are specified, this method returns all cookies. If URLs are specified, only cookies that affect those URLs * are returned. + * + * @since v1.8 */ default List cookies() { return cookies((String) null); @@ -373,6 +387,7 @@ public interface BrowserContext extends AutoCloseable { * are returned. * * @param urls Optional list of URLs. + * @since v1.8 */ List cookies(String urls); /** @@ -380,6 +395,7 @@ public interface BrowserContext extends AutoCloseable { * are returned. * * @param urls Optional list of URLs. + * @since v1.8 */ List cookies(List urls); /** @@ -439,6 +455,7 @@ public interface BrowserContext extends AutoCloseable { * * @param name Name of the function on the window object. * @param callback Callback function that will be called in the Playwright's context. + * @since v1.8 */ default void exposeBinding(String name, BindingCallback callback) { exposeBinding(name, callback, null); @@ -500,6 +517,7 @@ public interface BrowserContext extends AutoCloseable { * * @param name Name of the function on the window object. * @param callback Callback function that will be called in the Playwright's context. + * @since v1.8 */ void exposeBinding(String name, BindingCallback callback, ExposeBindingOptions options); /** @@ -557,6 +575,7 @@ public interface BrowserContext extends AutoCloseable { * * @param name Name of the function on the window object. * @param callback Callback function that will be called in the Playwright's context. + * @since v1.8 */ void exposeFunction(String name, FunctionCallback callback); /** @@ -581,6 +600,7 @@ public interface BrowserContext extends AutoCloseable { *

  • {@code "clipboard-write"}
  • *
  • {@code "payment-handler"}
  • * + * @since v1.8 */ default void grantPermissions(List permissions) { grantPermissions(permissions, null); @@ -607,18 +627,25 @@ public interface BrowserContext extends AutoCloseable { *
  • {@code "clipboard-write"}
  • *
  • {@code "payment-handler"}
  • * + * @since v1.8 */ void grantPermissions(List permissions, GrantPermissionsOptions options); /** * Creates a new page in the browser context. + * + * @since v1.8 */ Page newPage(); /** * Returns all open pages in the context. + * + * @since v1.8 */ List pages(); /** * API testing helper associated with this context. Requests made with this API will use context cookies. + * + * @since v1.16 */ APIRequestContext request(); /** @@ -671,6 +698,7 @@ public interface BrowserContext extends AutoCloseable { * context options was provided and the passed URL is a path, it gets merged via the {@code new URL()} constructor. * @param handler handler function to route the request. + * @since v1.8 */ default void route(String url, Consumer handler) { route(url, handler, null); @@ -725,6 +753,7 @@ public interface BrowserContext extends AutoCloseable { * context options was provided and the passed URL is a path, it gets merged via the {@code new URL()} constructor. * @param handler handler function to route the request. + * @since v1.8 */ void route(String url, Consumer handler, RouteOptions options); /** @@ -777,6 +806,7 @@ public interface BrowserContext extends AutoCloseable { * context options was provided and the passed URL is a path, it gets merged via the {@code new URL()} constructor. * @param handler handler function to route the request. + * @since v1.8 */ default void route(Pattern url, Consumer handler) { route(url, handler, null); @@ -831,6 +861,7 @@ public interface BrowserContext extends AutoCloseable { * context options was provided and the passed URL is a path, it gets merged via the {@code new URL()} constructor. * @param handler handler function to route the request. + * @since v1.8 */ void route(Pattern url, Consumer handler, RouteOptions options); /** @@ -883,6 +914,7 @@ public interface BrowserContext extends AutoCloseable { * context options was provided and the passed URL is a path, it gets merged via the {@code new URL()} constructor. * @param handler handler function to route the request. + * @since v1.8 */ default void route(Predicate url, Consumer handler) { route(url, handler, null); @@ -937,6 +969,7 @@ public interface BrowserContext extends AutoCloseable { * context options was provided and the passed URL is a path, it gets merged via the {@code new URL()} constructor. * @param handler handler function to route the request. + * @since v1.8 */ void route(Predicate url, Consumer handler, RouteOptions options); /** @@ -949,6 +982,7 @@ public interface BrowserContext extends AutoCloseable { * * @param har Path to a HAR file with prerecorded network data. If {@code * path} is a relative path, then it is resolved relative to the current working directory. + * @since v1.23 */ default void routeFromHAR(Path har) { routeFromHAR(har, null); @@ -963,6 +997,7 @@ public interface BrowserContext extends AutoCloseable { * * @param har Path to a HAR file with prerecorded network data. If {@code * path} is a relative path, then it is resolved relative to the current working directory. + * @since v1.23 */ void routeFromHAR(Path har, RouteFromHAROptions options); /** @@ -981,6 +1016,7 @@ public interface BrowserContext extends AutoCloseable { * BrowserContext.setDefaultNavigationTimeout()}. * * @param timeout Maximum navigation time in milliseconds + * @since v1.8 */ void setDefaultNavigationTimeout(double timeout); /** @@ -992,6 +1028,7 @@ public interface BrowserContext extends AutoCloseable { * BrowserContext.setDefaultTimeout()}. * * @param timeout Maximum time in milliseconds + * @since v1.8 */ void setDefaultTimeout(double timeout); /** @@ -1003,6 +1040,7 @@ public interface BrowserContext extends AutoCloseable { * in the outgoing requests. * * @param headers An object containing additional HTTP headers to be sent with every request. All header values must be strings. + * @since v1.8 */ void setExtraHTTPHeaders(Map headers); /** @@ -1015,24 +1053,36 @@ public interface BrowserContext extends AutoCloseable { * *

    NOTE: Consider using {@link BrowserContext#grantPermissions BrowserContext.grantPermissions()} to grant permissions for the * browser context pages to read its geolocation. + * + * @since v1.8 */ void setGeolocation(Geolocation geolocation); /** * * * @param offline Whether to emulate network being offline for the browser context. + * @since v1.8 */ void setOffline(boolean offline); /** * Returns storage state for this browser context, contains current cookies and local storage snapshot. + * + * @since v1.8 */ default String storageState() { return storageState(null); } /** * Returns storage state for this browser context, contains current cookies and local storage snapshot. + * + * @since v1.8 */ String storageState(StorageStateOptions options); + /** + * + * + * @since v1.12 + */ Tracing tracing(); /** * Removes a route created with {@link BrowserContext#route BrowserContext.route()}. When {@code handler} is not specified, @@ -1040,6 +1090,7 @@ public interface BrowserContext extends AutoCloseable { * * @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with {@link BrowserContext#route * BrowserContext.route()}. + * @since v1.8 */ default void unroute(String url) { unroute(url, null); @@ -1051,6 +1102,7 @@ public interface BrowserContext extends AutoCloseable { * @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with {@link BrowserContext#route * BrowserContext.route()}. * @param handler Optional handler function used to register a routing with {@link BrowserContext#route BrowserContext.route()}. + * @since v1.8 */ void unroute(String url, Consumer handler); /** @@ -1059,6 +1111,7 @@ public interface BrowserContext extends AutoCloseable { * * @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with {@link BrowserContext#route * BrowserContext.route()}. + * @since v1.8 */ default void unroute(Pattern url) { unroute(url, null); @@ -1070,6 +1123,7 @@ public interface BrowserContext extends AutoCloseable { * @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with {@link BrowserContext#route * BrowserContext.route()}. * @param handler Optional handler function used to register a routing with {@link BrowserContext#route BrowserContext.route()}. + * @since v1.8 */ void unroute(Pattern url, Consumer handler); /** @@ -1078,6 +1132,7 @@ public interface BrowserContext extends AutoCloseable { * * @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with {@link BrowserContext#route * BrowserContext.route()}. + * @since v1.8 */ default void unroute(Predicate url) { unroute(url, null); @@ -1089,6 +1144,7 @@ public interface BrowserContext extends AutoCloseable { * @param url A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with {@link BrowserContext#route * BrowserContext.route()}. * @param handler Optional handler function used to register a routing with {@link BrowserContext#route BrowserContext.route()}. + * @since v1.8 */ void unroute(Predicate url, Consumer handler); /** @@ -1097,6 +1153,7 @@ public interface BrowserContext extends AutoCloseable { * Will throw an error if the context closes before new {@code Page} is created. * * @param callback Callback that performs the action triggering the event. + * @since v1.9 */ default Page waitForPage(Runnable callback) { return waitForPage(null, callback); @@ -1107,6 +1164,7 @@ public interface BrowserContext extends AutoCloseable { * Will throw an error if the context closes before new {@code Page} is created. * * @param callback Callback that performs the action triggering the event. + * @since v1.9 */ Page waitForPage(WaitForPageOptions options, Runnable callback); } diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index 00d791a0..3fb82fab 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -1042,6 +1042,7 @@ public interface BrowserType { * compatible with 1.2.x). * * @param wsEndpoint A browser websocket endpoint to connect to. + * @since v1.8 */ default Browser connect(String wsEndpoint) { return connect(wsEndpoint, null); @@ -1052,6 +1053,7 @@ public interface BrowserType { * compatible with 1.2.x). * * @param wsEndpoint A browser websocket endpoint to connect to. + * @since v1.8 */ Browser connect(String wsEndpoint, ConnectOptions options); /** @@ -1070,6 +1072,7 @@ public interface BrowserType { * * @param endpointURL A CDP websocket endpoint or http url to connect to. For example {@code http://localhost:9222/} or {@code * ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4}. + * @since v1.9 */ default Browser connectOverCDP(String endpointURL) { return connectOverCDP(endpointURL, null); @@ -1090,10 +1093,13 @@ public interface BrowserType { * * @param endpointURL A CDP websocket endpoint or http url to connect to. For example {@code http://localhost:9222/} or {@code * ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4}. + * @since v1.9 */ Browser connectOverCDP(String endpointURL, ConnectOverCDPOptions options); /** * A path where Playwright expects to find a bundled browser executable. + * + * @since v1.8 */ String executablePath(); /** @@ -1126,6 +1132,8 @@ public interface BrowserType { * other differences between Chromium and Chrome. This article * describes some differences for Linux users. + * + * @since v1.8 */ default Browser launch() { return launch(null); @@ -1160,6 +1168,8 @@ public interface BrowserType { * other differences between Chromium and Chrome. This article * describes some differences for Linux users. + * + * @since v1.8 */ Browser launch(LaunchOptions options); /** @@ -1173,6 +1183,7 @@ public interface BrowserType { * href="https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile">Firefox. Note that * Chromium's user data directory is the **parent** directory of the "Profile Path" seen at {@code chrome://version}. Pass * an empty string to use a temporary directory instead. + * @since v1.8 */ default BrowserContext launchPersistentContext(Path userDataDir) { return launchPersistentContext(userDataDir, null); @@ -1188,10 +1199,13 @@ public interface BrowserType { * href="https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options#User_Profile">Firefox. Note that * Chromium's user data directory is the **parent** directory of the "Profile Path" seen at {@code chrome://version}. Pass * an empty string to use a temporary directory instead. + * @since v1.8 */ BrowserContext launchPersistentContext(Path userDataDir, LaunchPersistentContextOptions options); /** * Returns browser name. For example: {@code "chromium"}, {@code "webkit"} or {@code "firefox"}. + * + * @since v1.8 */ String name(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java b/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java index 69c0273d..222f472a 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java +++ b/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java @@ -46,14 +46,20 @@ public interface ConsoleMessage { /** * List of arguments passed to a {@code console} function call. See also {@link Page#onConsoleMessage * Page.onConsoleMessage()}. + * + * @since v1.8 */ List args(); /** * URL of the resource followed by 0-based line and column numbers in the resource formatted as {@code URL:line:column}. + * + * @since v1.8 */ String location(); /** * The text of the console message. + * + * @since v1.8 */ String text(); /** @@ -61,6 +67,8 @@ public interface ConsoleMessage { * "dir"}, {@code "dirxml"}, {@code "table"}, {@code "trace"}, {@code "clear"}, {@code "startGroup"}, {@code * "startGroupCollapsed"}, {@code "endGroup"}, {@code "assert"}, {@code "profile"}, {@code "profileEnd"}, {@code "count"}, * {@code "timeEnd"}. + * + * @since v1.8 */ String type(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/Dialog.java b/playwright/src/main/java/com/microsoft/playwright/Dialog.java index c45dc882..78dbcc83 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Dialog.java +++ b/playwright/src/main/java/com/microsoft/playwright/Dialog.java @@ -50,6 +50,8 @@ package com.microsoft.playwright; public interface Dialog { /** * Returns when the dialog has been accepted. + * + * @since v1.8 */ default void accept() { accept(null); @@ -58,22 +60,31 @@ 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. + * @since v1.8 */ void accept(String promptText); /** * If dialog is prompt, returns default prompt value. Otherwise, returns empty string. + * + * @since v1.8 */ String defaultValue(); /** * Returns when the dialog has been dismissed. + * + * @since v1.8 */ void dismiss(); /** * A message displayed in the dialog. + * + * @since v1.8 */ String message(); /** * Returns dialog's type, can be one of {@code alert}, {@code beforeunload}, {@code confirm} or {@code prompt}. + * + * @since v1.8 */ String type(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/Download.java b/playwright/src/main/java/com/microsoft/playwright/Download.java index 4801af93..ca8cbc6f 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Download.java +++ b/playwright/src/main/java/com/microsoft/playwright/Download.java @@ -38,22 +38,32 @@ public interface Download { /** * Cancels a download. Will not fail if the download is already finished or canceled. Upon successful cancellations, {@code * download.failure()} would resolve to {@code "canceled"}. + * + * @since v1.13 */ void cancel(); /** * Returns readable stream for current download or {@code null} if download failed. + * + * @since v1.8 */ InputStream createReadStream(); /** * Deletes the downloaded file. Will wait for the download to finish if necessary. + * + * @since v1.8 */ void delete(); /** * Returns download error if any. Will wait for the download to finish if necessary. + * + * @since v1.8 */ String failure(); /** * Get the page that the download belongs to. + * + * @since v1.12 */ Page page(); /** @@ -62,6 +72,8 @@ public interface Download { * *

    Note that the download's file name is a random GUID, use {@link Download#suggestedFilename Download.suggestedFilename()} * to get suggested file name. + * + * @since v1.8 */ Path path(); /** @@ -69,6 +81,7 @@ public interface Download { * wait for the download to finish if necessary. * * @param path Path where the download should be copied. + * @since v1.8 */ void saveAs(Path path); /** @@ -77,10 +90,14 @@ public interface Download { * response header or the {@code download} attribute. See the spec on whatwg. Different browsers can use different logic for * computing it. + * + * @since v1.8 */ String suggestedFilename(); /** * Returns downloaded url. + * + * @since v1.8 */ String url(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java index 31531a59..8419fe45 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -1244,6 +1244,8 @@ public interface ElementHandle extends JSHandle { * BoundingBox box = elementHandle.boundingBox(); * page.mouse().click(box.x + box.width / 2, box.y + box.height / 2); * } + * + * @since v1.8 */ BoundingBox boundingBox(); /** @@ -1263,6 +1265,8 @@ public interface ElementHandle extends JSHandle { * *

    When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code * TimeoutError}. Passing zero timeout disables this. + * + * @since v1.8 */ default void check() { check(null); @@ -1284,6 +1288,8 @@ public interface ElementHandle extends JSHandle { * *

    When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code * TimeoutError}. Passing zero timeout disables this. + * + * @since v1.8 */ void check(CheckOptions options); /** @@ -1300,6 +1306,8 @@ public interface ElementHandle extends JSHandle { * *

    When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code * TimeoutError}. Passing zero timeout disables this. + * + * @since v1.8 */ default void click() { click(null); @@ -1318,10 +1326,14 @@ public interface ElementHandle extends JSHandle { * *

    When all steps combined have not finished during the specified {@code timeout}, this method throws a {@code * TimeoutError}. Passing zero timeout disables this. + * + * @since v1.8 */ void click(ClickOptions options); /** * Returns the content frame for element handles referencing iframe nodes, or {@code null} otherwise + * + * @since v1.8 */ Frame contentFrame(); /** @@ -1341,6 +1353,8 @@ public interface ElementHandle extends JSHandle { * TimeoutError}. Passing zero timeout disables this. * *

    NOTE: {@code elementHandle.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. + * + * @since v1.8 */ default void dblclick() { dblclick(null); @@ -1362,6 +1376,8 @@ public interface ElementHandle extends JSHandle { * TimeoutError}. Passing zero timeout disables this. * *

    NOTE: {@code elementHandle.dblclick()} dispatches two {@code click} events and a single {@code dblclick} event. + * + * @since v1.8 */ void dblclick(DblclickOptions options); /** @@ -1399,6 +1415,7 @@ public interface ElementHandle extends JSHandle { * } * * @param type DOM event type: {@code "click"}, {@code "dragstart"}, etc. + * @since v1.8 */ default void dispatchEvent(String type) { dispatchEvent(type, null); @@ -1439,6 +1456,7 @@ public interface ElementHandle extends JSHandle { * * @param type DOM event type: {@code "click"}, {@code "dragstart"}, etc. * @param eventInit Optional event-specific initialization properties. + * @since v1.8 */ void dispatchEvent(String type, Object eventInit); /** @@ -1461,6 +1479,7 @@ public interface ElementHandle extends JSHandle { * @param selector A selector to query for. * @param expression JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is * automatically invoked. + * @since v1.9 */ default Object evalOnSelector(String selector, String expression) { return evalOnSelector(selector, expression, null); @@ -1486,6 +1505,7 @@ public interface ElementHandle extends JSHandle { * @param expression JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is * automatically invoked. * @param arg Optional argument to pass to {@code expression}. + * @since v1.9 */ Object evalOnSelector(String selector, String expression, Object arg); /** @@ -1508,6 +1528,7 @@ public interface ElementHandle extends JSHandle { * @param selector A selector to query for. * @param expression JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is * automatically invoked. + * @since v1.9 */ default Object evalOnSelectorAll(String selector, String expression) { return evalOnSelectorAll(selector, expression, null); @@ -1533,6 +1554,7 @@ public interface ElementHandle extends JSHandle { * @param expression JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is * automatically invoked. * @param arg Optional argument to pass to {@code expression}. + * @since v1.9 */ Object evalOnSelectorAll(String selector, String expression, Object arg); /** @@ -1548,6 +1570,7 @@ public interface ElementHandle extends JSHandle { *

    To send fine-grained keyboard events, use {@link ElementHandle#type ElementHandle.type()}. * * @param value Value to set for the {@code }, {@code