diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java index 35338811e..6eb2f8daf 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java @@ -127,6 +127,16 @@ public interface BrowserContext extends AutoCloseable { */ void offPage(Consumer handler); + /** + * Emitted when unhandled exceptions occur on any pages created through this context. To only listen for {@code pageError} + * events from a particular page, use {@link Page#onPageError Page.onPageError()}. + */ + void onPageError(Consumer handler); + /** + * Removes handler that was previously added with {@link #onPageError onPageError(handler)}. + */ + void offPageError(Consumer handler); + /** * Emitted when a request is issued from any pages created through this context. The [request] object is read-only. To only * listen for requests from a particular page, use {@link Page#onRequest Page.onRequest()}. diff --git a/playwright/src/main/java/com/microsoft/playwright/Download.java b/playwright/src/main/java/com/microsoft/playwright/Download.java index ca8cbc6f7..b51051150 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Download.java +++ b/playwright/src/main/java/com/microsoft/playwright/Download.java @@ -24,14 +24,16 @@ * *

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

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

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

{@code
- * // wait for download to start
+ * // Wait for the download to start
  * Download download = page.waitForDownload(() -> {
- *   page.getByText("Download file").click();
+ *     // Perform the action that initiates download
+ *     page.getByText("Download file").click();
  * });
- * // wait for download to complete
- * Path path = download.path();
+ *
+ * // Wait for the download process to complete and save the downloaded file somewhere
+ * download.saveAs(Paths.get("/path/to/save/at/", download.suggestedFilename()));
  * }
*/ public interface Download { @@ -80,6 +82,11 @@ public interface Download { * Copy the download to a user-specified path. It is safe to call this method while the download is still in progress. Will * wait for the download to finish if necessary. * + *

**Usage** + *

{@code
+   * download.saveAs(Paths.get("/path/to/save/at/", download.suggestedFilename()));
+   * }
+ * * @param path Path where the download should be copied. * @since v1.8 */ diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java index 29d9477c3..eb6828b74 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -1582,7 +1582,7 @@ default Object evalOnSelectorAll(String selector, String expression) { * href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/control">control, the control will be filled * instead. * - *

To send fine-grained keyboard events, use {@link ElementHandle#type ElementHandle.type()}. + *

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