Compare commits
3 Commits
release-1.62
...
v1.43.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 26861a2f1e | |||
| 04e77b9c9a | |||
| ccf4575bc8 |
@@ -11,7 +11,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
|
|||||||
|
|
||||||
| | Linux | macOS | Windows |
|
| | Linux | macOS | Windows |
|
||||||
| :--- | :---: | :---: | :---: |
|
| :--- | :---: | :---: | :---: |
|
||||||
| Chromium <!-- GEN:chromium-version -->124.0.6367.18<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| Chromium <!-- GEN:chromium-version -->124.0.6367.29<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||||
| Firefox <!-- GEN:firefox-version -->124.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| Firefox <!-- GEN:firefox-version -->124.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>parent-pom</artifactId>
|
<artifactId>parent-pom</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>driver-bundle</artifactId>
|
<artifactId>driver-bundle</artifactId>
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>parent-pom</artifactId>
|
<artifactId>parent-pom</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>driver</artifactId>
|
<artifactId>driver</artifactId>
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>org.example</groupId>
|
<groupId>org.example</groupId>
|
||||||
<artifactId>examples</artifactId>
|
<artifactId>examples</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
<name>Playwright Client Examples</name>
|
<name>Playwright Client Examples</name>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>parent-pom</artifactId>
|
<artifactId>parent-pom</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>playwright</artifactId>
|
<artifactId>playwright</artifactId>
|
||||||
|
|||||||
@@ -44,23 +44,6 @@ import java.util.regex.Pattern;
|
|||||||
*/
|
*/
|
||||||
public interface BrowserContext extends AutoCloseable {
|
public interface BrowserContext extends AutoCloseable {
|
||||||
|
|
||||||
/**
|
|
||||||
* <strong>NOTE:</strong> Only works with Chromium browser's persistent context.
|
|
||||||
*
|
|
||||||
* <p> Emitted when new background page is created in the context.
|
|
||||||
* <pre>{@code
|
|
||||||
* Page backgroundPage = context.waitForBackgroundPage(() -> {
|
|
||||||
* page.getByText("activate extension").click();
|
|
||||||
* });
|
|
||||||
* System.out.println(backgroundPage.evaluate("location.href"));
|
|
||||||
* }</pre>
|
|
||||||
*/
|
|
||||||
void onBackgroundPage(Consumer<Page> handler);
|
|
||||||
/**
|
|
||||||
* Removes handler that was previously added with {@link #onBackgroundPage onBackgroundPage(handler)}.
|
|
||||||
*/
|
|
||||||
void offBackgroundPage(Consumer<Page> handler);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emitted when Browser context gets closed. This might happen because of one of the following:
|
* Emitted when Browser context gets closed. This might happen because of one of the following:
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -568,14 +551,6 @@ public interface BrowserContext extends AutoCloseable {
|
|||||||
* @since v1.8
|
* @since v1.8
|
||||||
*/
|
*/
|
||||||
void addInitScript(Path script);
|
void addInitScript(Path script);
|
||||||
/**
|
|
||||||
* <strong>NOTE:</strong> Background pages are only supported on Chromium-based browsers.
|
|
||||||
*
|
|
||||||
* <p> All existing background pages in the context.
|
|
||||||
*
|
|
||||||
* @since v1.11
|
|
||||||
*/
|
|
||||||
List<Page> backgroundPages();
|
|
||||||
/**
|
/**
|
||||||
* Returns the browser instance of the context. If it was launched as a persistent context null gets returned.
|
* Returns the browser instance of the context. If it was launched as a persistent context null gets returned.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
|||||||
private final TracingImpl tracing;
|
private final TracingImpl tracing;
|
||||||
private final APIRequestContextImpl request;
|
private final APIRequestContextImpl request;
|
||||||
final List<PageImpl> pages = new ArrayList<>();
|
final List<PageImpl> pages = new ArrayList<>();
|
||||||
final List<PageImpl> backgroundPages = new ArrayList<>();
|
|
||||||
|
|
||||||
final Router routes = new Router();
|
final Router routes = new Router();
|
||||||
private boolean closeWasCalled;
|
private boolean closeWasCalled;
|
||||||
@@ -83,7 +82,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum EventType {
|
enum EventType {
|
||||||
BACKGROUNDPAGE,
|
|
||||||
CLOSE,
|
CLOSE,
|
||||||
CONSOLE,
|
CONSOLE,
|
||||||
DIALOG,
|
DIALOG,
|
||||||
@@ -131,16 +129,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackgroundPage(Consumer<Page> handler) {
|
|
||||||
listeners.add(EventType.BACKGROUNDPAGE, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void offBackgroundPage(Consumer<Page> handler) {
|
|
||||||
listeners.remove(EventType.BACKGROUNDPAGE, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose(Consumer<BrowserContext> handler) {
|
public void onClose(Consumer<BrowserContext> handler) {
|
||||||
listeners.add(EventType.CLOSE, handler);
|
listeners.add(EventType.CLOSE, handler);
|
||||||
@@ -337,11 +325,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Page> backgroundPages() {
|
|
||||||
return new ArrayList<>(backgroundPages);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addInitScriptImpl(String script) {
|
private void addInitScriptImpl(String script) {
|
||||||
JsonObject params = new JsonObject();
|
JsonObject params = new JsonObject();
|
||||||
params.addProperty("source", script);
|
params.addProperty("source", script);
|
||||||
@@ -730,10 +713,6 @@ class BrowserContextImpl extends ChannelOwner implements BrowserContext {
|
|||||||
if (page.opener() != null && !page.opener().isClosed()) {
|
if (page.opener() != null && !page.opener().isClosed()) {
|
||||||
page.opener().notifyPopup(page);
|
page.opener().notifyPopup(page);
|
||||||
}
|
}
|
||||||
} else if ("backgroundPage".equals(event)) {
|
|
||||||
PageImpl page = connection.getExistingObject(params.getAsJsonObject("page").get("guid").getAsString());
|
|
||||||
backgroundPages.add(page);
|
|
||||||
listeners.notify(EventType.BACKGROUNDPAGE, page);
|
|
||||||
} else if ("bindingCall".equals(event)) {
|
} else if ("bindingCall".equals(event)) {
|
||||||
BindingCall bindingCall = connection.getExistingObject(params.getAsJsonObject("binding").get("guid").getAsString());
|
BindingCall bindingCall = connection.getExistingObject(params.getAsJsonObject("binding").get("guid").getAsString());
|
||||||
BindingCallback binding = bindings.get(bindingCall.name());
|
BindingCallback binding = bindings.get(bindingCall.name());
|
||||||
|
|||||||
@@ -203,7 +203,6 @@ public class PageImpl extends ChannelOwner implements Page {
|
|||||||
void didClose() {
|
void didClose() {
|
||||||
isClosed = true;
|
isClosed = true;
|
||||||
browserContext.pages.remove(this);
|
browserContext.pages.remove(this);
|
||||||
browserContext.backgroundPages.remove(this);
|
|
||||||
listeners.notify(EventType.CLOSE, this);
|
listeners.notify(EventType.CLOSE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,30 +59,4 @@ public class TestLaunch extends TestBase {
|
|||||||
public static boolean canRunExtensionTest() {
|
public static boolean canRunExtensionTest() {
|
||||||
return canRunHeaded() && isChromium();
|
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<Page> backgroundPages = context.backgroundPages();
|
|
||||||
context.onBackgroundPage(page1 -> backgroundPages.add(page1));
|
|
||||||
context.waitForCondition(() -> !backgroundPages.isEmpty(),
|
|
||||||
new BrowserContext.WaitForConditionOptions().setTimeout(10_000));
|
|
||||||
Page backgroundPage = backgroundPages.get(0);
|
|
||||||
assertNotNull(backgroundPage);
|
|
||||||
assertTrue(context.backgroundPages().contains(backgroundPage));
|
|
||||||
assertFalse(context.pages().contains(backgroundPage));
|
|
||||||
context.close();
|
|
||||||
assertEquals(0, context.pages().size());
|
|
||||||
assertEquals(0, context.backgroundPages().size());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>parent-pom</artifactId>
|
<artifactId>parent-pom</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Playwright Parent Project</name>
|
<name>Playwright Parent Project</name>
|
||||||
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
|
<description>Java library to automate Chromium, Firefox and WebKit with a single API.
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.44.0-alpha-2024-04-02
|
1.43.0
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>api-generator</artifactId>
|
<artifactId>api-generator</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
<name>Playwright - API Generator</name>
|
<name>Playwright - API Generator</name>
|
||||||
<description>
|
<description>
|
||||||
This is an internal module used to generate Java API from the upstream Playwright
|
This is an internal module used to generate Java API from the upstream Playwright
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>test-cli-fatjar</artifactId>
|
<artifactId>test-cli-fatjar</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
<name>Test Playwright Command Line FatJar</name>
|
<name>Test Playwright Command Line FatJar</name>
|
||||||
<properties>
|
<properties>
|
||||||
<compiler.version>1.8</compiler.version>
|
<compiler.version>1.8</compiler.version>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>test-cli-version</artifactId>
|
<artifactId>test-cli-version</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
<name>Test Playwright Command Line Version</name>
|
<name>Test Playwright Command Line Version</name>
|
||||||
<properties>
|
<properties>
|
||||||
<compiler.version>1.8</compiler.version>
|
<compiler.version>1.8</compiler.version>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>test-local-installation</artifactId>
|
<artifactId>test-local-installation</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
<name>Test local installation</name>
|
<name>Test local installation</name>
|
||||||
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
|
<description>Runs Playwright test suite (copied from playwright module) against locally cached Playwright</description>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>test-spring-boot-starter</artifactId>
|
<artifactId>test-spring-boot-starter</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
<name>Test Playwright With Spring Boot</name>
|
<name>Test Playwright With Spring Boot</name>
|
||||||
<properties>
|
<properties>
|
||||||
<spring.version>2.4.3</spring.version>
|
<spring.version>2.4.3</spring.version>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.microsoft.playwright</groupId>
|
<groupId>com.microsoft.playwright</groupId>
|
||||||
<artifactId>update-version</artifactId>
|
<artifactId>update-version</artifactId>
|
||||||
<version>1.43.0-SNAPSHOT</version>
|
<version>1.43.0</version>
|
||||||
<name>Playwright - Update Version in Documentation</name>
|
<name>Playwright - Update Version in Documentation</name>
|
||||||
<description>
|
<description>
|
||||||
This is an internal module used to update versions in the documentation based on
|
This is an internal module used to update versions in the documentation based on
|
||||||
|
|||||||
Reference in New Issue
Block a user