diff --git a/README.md b/README.md index f1a17428..9093b4f2 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 120.0.6099.28 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Chromium 121.0.6167.16 | :white_check_mark: | :white_check_mark: | :white_check_mark: | | WebKit 17.4 | ✅ | ✅ | ✅ | -| Firefox 119.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Firefox 120.0.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | Headless execution is supported for all the browsers on all platforms. Check out [system requirements](https://playwright.dev/java/docs/intro#system-requirements) for details. diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java index 86e71d89..14f2cf6d 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java @@ -1260,6 +1260,13 @@ public interface BrowserContext extends AutoCloseable { * @since v1.12 */ Tracing tracing(); + /** + * Removes all routes created with {@link BrowserContext#route BrowserContext.route()} and {@link + * BrowserContext#routeFromHAR BrowserContext.routeFromHAR()}. + * + * @since v1.41 + */ + void unrouteAll(); /** * Removes a route created with {@link BrowserContext#route BrowserContext.route()}. When {@code handler} is not specified, * removes all routes for the {@code url}. diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index ac0bba3e..b7703540 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -165,8 +165,10 @@ public interface BrowserType { } class LaunchOptions { /** - * Additional arguments to pass to the browser instance. The list of Chromium flags can be found here. + * NOTE: Use custom browser args at your own risk, as some of them may break Playwright functionality. + * + *
Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
*/
public List Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
*/
public LaunchOptions setArgs(List Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
*/
public List Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.
*/
public LaunchPersistentContextOptions setArgs(List Defaults to {@code "device"}.
*/
public ScreenshotScale scale;
+ /**
+ * Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements
+ * invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM
+ * and applies to the inner frames.
+ */
+ public String style;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
@@ -719,6 +725,15 @@ public interface ElementHandle extends JSHandle {
this.scale = scale;
return this;
}
+ /**
+ * Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements
+ * invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM
+ * and applies to the inner frames.
+ */
+ public ScreenshotOptions setStyle(String style) {
+ this.style = style;
+ return this;
+ }
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
diff --git a/playwright/src/main/java/com/microsoft/playwright/Frame.java b/playwright/src/main/java/com/microsoft/playwright/Frame.java
index dc641ff4..d1aef5da 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Frame.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Frame.java
@@ -1470,8 +1470,14 @@ public interface Frame {
}
class LocatorOptions {
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
@@ -1497,8 +1503,14 @@ public interface Frame {
public Object hasText;
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
diff --git a/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java b/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java
index 6f5088c6..d3b14279 100644
--- a/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java
+++ b/playwright/src/main/java/com/microsoft/playwright/FrameLocator.java
@@ -285,8 +285,14 @@ public interface FrameLocator {
}
class LocatorOptions {
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
@@ -312,8 +318,14 @@ public interface FrameLocator {
public Object hasText;
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
diff --git a/playwright/src/main/java/com/microsoft/playwright/Locator.java b/playwright/src/main/java/com/microsoft/playwright/Locator.java
index a55c62a9..7c6d1dbd 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Locator.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Locator.java
@@ -656,8 +656,14 @@ public interface Locator {
}
class FilterOptions {
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
@@ -683,8 +689,14 @@ public interface Locator {
public Object hasText;
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
@@ -1262,8 +1274,14 @@ public interface Locator {
}
class LocatorOptions {
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
@@ -1289,8 +1307,14 @@ public interface Locator {
public Object hasText;
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
@@ -1483,6 +1507,12 @@ public interface Locator {
* Defaults to {@code "device"}.
*/
public ScreenshotScale scale;
+ /**
+ * Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements
+ * invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM
+ * and applies to the inner frames.
+ */
+ public String style;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
@@ -1568,6 +1598,15 @@ public interface Locator {
this.scale = scale;
return this;
}
+ /**
+ * Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements
+ * invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM
+ * and applies to the inner frames.
+ */
+ public ScreenshotOptions setStyle(String style) {
+ this.style = style;
+ return this;
+ }
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
diff --git a/playwright/src/main/java/com/microsoft/playwright/Page.java b/playwright/src/main/java/com/microsoft/playwright/Page.java
index 751fe68e..7259936f 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Page.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Page.java
@@ -1924,8 +1924,14 @@ public interface Page extends AutoCloseable {
}
class LocatorOptions {
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
@@ -1951,8 +1957,14 @@ public interface Page extends AutoCloseable {
public Object hasText;
/**
- * Matches elements containing an element that matches an inner locator. Inner locator is queried against the outer one.
- * For example, {@code article} that has {@code text=Playwright} matches {@code Inner locator **must be relative** to the outer locator and is queried starting with the outer locator match, not the
+ * document root. For example, you can find {@code content} that has {@code div} in {@code
+ * Note that outer and inner locators must belong to the same frame. Inner locator must not contain {@code FrameLocator}s.
*/
@@ -2450,6 +2462,12 @@ public interface Page extends AutoCloseable {
* Defaults to {@code "device"}.
*/
public ScreenshotScale scale;
+ /**
+ * Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements
+ * invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM
+ * and applies to the inner frames.
+ */
+ public String style;
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
@@ -2556,6 +2574,15 @@ public interface Page extends AutoCloseable {
this.scale = scale;
return this;
}
+ /**
+ * Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements
+ * invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM
+ * and applies to the inner frames.
+ */
+ public ScreenshotOptions setStyle(String style) {
+ this.style = style;
+ return this;
+ }
/**
* Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default
* value can be changed by using the {@link BrowserContext#setDefaultTimeout BrowserContext.setDefaultTimeout()} or {@link
@@ -7030,6 +7057,12 @@ public interface Page extends AutoCloseable {
* @since v1.8
*/
void uncheck(String selector, UncheckOptions options);
+ /**
+ * Removes all routes created with {@link Page#route Page.route()} and {@link Page#routeFromHAR Page.routeFromHAR()}.
+ *
+ * @since v1.41
+ */
+ void unrouteAll();
/**
* Removes a route created with {@link Page#route Page.route()}. When {@code handler} is not specified, removes all routes
* for the {@code url}.
diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java
index f0e85770..9108ea74 100644
--- a/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java
+++ b/playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java
@@ -568,6 +568,14 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
return tracing;
}
+ @Override
+ public void unrouteAll() {
+ withLogging("BrowserContext.unrouteAll", () -> {
+ routes.removeAll();
+ updateInterceptionPatterns();
+ });
+ }
+
@Override
public void unroute(String url, Consumer