Client certificate authentication is only active when at least one client certificate is provided. If you want to reject + * all client certificates sent by the server, you need to provide a client certificate with an {@code origin} that does + * not match any of the domains you plan to visit. + * *
NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ @@ -134,6 +138,10 @@ public NewContextOptions setBaseURL(String baseURL) { * {@code pfx}). Optionally, {@code passphrase} property should be provided if the certificate is encrypted. The {@code * origin} property should be provided with an exact match to the request origin that the certificate is valid for. * + *
Client certificate authentication is only active when at least one client certificate is provided. If you want to reject + * all client certificates sent by the server, you need to provide a client certificate with an {@code origin} that does + * not match any of the domains you plan to visit. + * *
NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java index 265e02fdb..793ea1dc5 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Browser.java +++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java @@ -106,6 +106,10 @@ class NewContextOptions { * {@code pfx}). Optionally, {@code passphrase} property should be provided if the certificate is encrypted. The {@code * origin} property should be provided with an exact match to the request origin that the certificate is valid for. * + *
Client certificate authentication is only active when at least one client certificate is provided. If you want to reject + * all client certificates sent by the server, you need to provide a client certificate with an {@code origin} that does + * not match any of the domains you plan to visit. + * *
NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ @@ -323,6 +327,10 @@ public NewContextOptions setBypassCSP(boolean bypassCSP) { * {@code pfx}). Optionally, {@code passphrase} property should be provided if the certificate is encrypted. The {@code * origin} property should be provided with an exact match to the request origin that the certificate is valid for. * + *
Client certificate authentication is only active when at least one client certificate is provided. If you want to reject + * all client certificates sent by the server, you need to provide a client certificate with an {@code origin} that does + * not match any of the domains you plan to visit. + * *
NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ @@ -674,6 +682,10 @@ class NewPageOptions { * {@code pfx}). Optionally, {@code passphrase} property should be provided if the certificate is encrypted. The {@code * origin} property should be provided with an exact match to the request origin that the certificate is valid for. * + *
Client certificate authentication is only active when at least one client certificate is provided. If you want to reject + * all client certificates sent by the server, you need to provide a client certificate with an {@code origin} that does + * not match any of the domains you plan to visit. + * *
NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ @@ -891,6 +903,10 @@ public NewPageOptions setBypassCSP(boolean bypassCSP) { * {@code pfx}). Optionally, {@code passphrase} property should be provided if the certificate is encrypted. The {@code * origin} property should be provided with an exact match to the request origin that the certificate is valid for. * + *
Client certificate authentication is only active when at least one client certificate is provided. If you want to reject + * all client certificates sent by the server, you need to provide a client certificate with an {@code origin} that does + * not match any of the domains you plan to visit. + * *
NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index 0a2782fc9..54864b3b0 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -491,6 +491,10 @@ class LaunchPersistentContextOptions { * {@code pfx}). Optionally, {@code passphrase} property should be provided if the certificate is encrypted. The {@code * origin} property should be provided with an exact match to the request origin that the certificate is valid for. * + *
Client certificate authentication is only active when at least one client certificate is provided. If you want to reject + * all client certificates sent by the server, you need to provide a client certificate with an {@code origin} that does + * not match any of the domains you plan to visit. + * *
NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ @@ -813,6 +817,10 @@ public LaunchPersistentContextOptions setChromiumSandbox(boolean chromiumSandbox * {@code pfx}). Optionally, {@code passphrase} property should be provided if the certificate is encrypted. The {@code * origin} property should be provided with an exact match to the request origin that the certificate is valid for. * + *
Client certificate authentication is only active when at least one client certificate is provided. If you want to reject + * all client certificates sent by the server, you need to provide a client certificate with an {@code origin} that does + * not match any of the domains you plan to visit. + * *
NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ @@ -1386,6 +1394,11 @@ default Browser launch() { * the **parent** directory of the "Profile Path" seen at {@code chrome://version}. * *
Note that browsers do not allow launching multiple instances with the same User Data Directory. + * + *
NOTE: Chromium/Chrome: Due to recent Chrome policy changes, automating the default Chrome user profile is not supported. + * Pointing {@code userDataDir} to Chrome's main "User Data" directory (the profile used for your regular browsing) may + * result in pages not loading or the browser exiting. Create and use a separate directory (for example, an empty folder) + * as your automation profile instead. See https://developer.chrome.com/blog/remote-debugging-port for details. * @since v1.8 */ default BrowserContext launchPersistentContext(Path userDataDir) { @@ -1406,6 +1419,11 @@ default BrowserContext launchPersistentContext(Path userDataDir) { * the **parent** directory of the "Profile Path" seen at {@code chrome://version}. * *
Note that browsers do not allow launching multiple instances with the same User Data Directory. + * + *
NOTE: Chromium/Chrome: Due to recent Chrome policy changes, automating the default Chrome user profile is not supported. + * Pointing {@code userDataDir} to Chrome's main "User Data" directory (the profile used for your regular browsing) may + * result in pages not loading or the browser exiting. Create and use a separate directory (for example, an empty folder) + * as your automation profile instead. See https://developer.chrome.com/blog/remote-debugging-port for details. * @since v1.8 */ BrowserContext launchPersistentContext(Path userDataDir, LaunchPersistentContextOptions options); diff --git a/playwright/src/main/java/com/microsoft/playwright/Page.java b/playwright/src/main/java/com/microsoft/playwright/Page.java index 3f7158283..8a00b22ff 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Page.java +++ b/playwright/src/main/java/com/microsoft/playwright/Page.java @@ -5812,8 +5812,8 @@ default Locator locator(String selector) { */ Page opener(); /** - * Pauses script execution. Playwright will stop executing the script and wait for the user to either press 'Resume' button - * in the page overlay or to call {@code playwright.resume()} in the DevTools console. + * Pauses script execution. Playwright will stop executing the script and wait for the user to either press the 'Resume' + * button in the page overlay or to call {@code playwright.resume()} in the DevTools console. * *
User can inspect selectors or perform manual steps while paused. Resume will continue running the original script from
* the place it was paused.
diff --git a/playwright/src/test/java/com/microsoft/playwright/TestDownload.java b/playwright/src/test/java/com/microsoft/playwright/TestDownload.java
index be942cf8a..9b08a1ce3 100644
--- a/playwright/src/test/java/com/microsoft/playwright/TestDownload.java
+++ b/playwright/src/test/java/com/microsoft/playwright/TestDownload.java
@@ -93,18 +93,12 @@ void shouldReportDownloadWhenNavigationTurnsIntoDownload() throws IOException {
assertTrue(Files.exists(path));
byte[] bytes = readAllBytes(path);
assertEquals("Hello world", new String(bytes, UTF_8));
- if (isChromium()) {
- assertNotNull(error[0]);
- assertTrue(error[0].getMessage().contains("net::ERR_ABORTED"));
- assertEquals("about:blank", page.url());
- } else if (isWebKit()) {
- assertNotNull(error[0]);
- assertTrue(error[0].getMessage().contains("Download is starting"));
- assertEquals("about:blank", page.url());
- } else {
- assertNotNull(error[0]);
+ assertNotNull(error[0]);
+ if (!chromiumVersionLessThan(browser.version(), "140.0.0.0")) {
assertTrue(error[0].getMessage().contains("Download is starting"));
}
+ if (!isFirefox())
+ assertEquals("about:blank", page.url());
page.close();
}
diff --git a/playwright/src/test/java/com/microsoft/playwright/TestLaunch.java b/playwright/src/test/java/com/microsoft/playwright/TestLaunch.java
deleted file mode 100644
index c0e60d633..000000000
--- a/playwright/src/test/java/com/microsoft/playwright/TestLaunch.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) Microsoft Corporation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.microsoft.playwright;
-
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIf;
-import org.junit.jupiter.api.io.TempDir;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-
-import static com.microsoft.playwright.Utils.mapOf;
-import static java.util.Arrays.asList;
-import static org.junit.jupiter.api.Assertions.*;
-
-public class TestLaunch extends TestBase {
-
- @Override
- @BeforeAll
- // Hide base class method to not launch browser.
- void launchBrowser() {
- }
-
- @Override
- void createContextAndPage() {
- // Do nothing
- }
-
- @Test
- void passEnvVar() {
- BrowserType.LaunchOptions options = new BrowserType.LaunchOptions();
- options.setEnv(mapOf("DEBUG", "pw:protocol"));
- launchBrowser(options);
- }
-
- public static boolean canRunHeaded() {
- // On linux headed browser requires xvfb.
- return isHeadful() || isMac || isWindows;
- }
-
- public static boolean canRunExtensionTest() {
- return canRunHeaded() && isChromium();
- }
-
- @Test
- @EnabledIf(value="com.microsoft.playwright.TestLaunch#canRunExtensionTest", disabledReason="Only Chromium Headed")
- void shouldReturnBackgroundPages(@TempDir Path tmpDir) throws IOException {
- Path profileDir = tmpDir.resolve("profile");
- Files.createDirectories(profileDir);
- String extensionPath = Paths.get("src/test/resources/simple-extension").toAbsolutePath().toString();
- initBrowserType();
- BrowserContext context = browserType.launchPersistentContext(profileDir, new BrowserType.LaunchPersistentContextOptions()
- .setHeadless(false)
- .setArgs(asList(
- "--disable-extensions-except=" + extensionPath,
- "--load-extension=" + extensionPath
- )));
- List