diff --git a/assertions/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java b/assertions/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java
index 978c9b54..9de2720d 100644
--- a/assertions/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java
+++ b/assertions/src/test/java/com/microsoft/playwright/TestLocatorAssertions.java
@@ -160,7 +160,7 @@ public class TestLocatorAssertions extends TestBase {
fail("did not throw");
} catch (AssertionFailedError e) {
assertEquals("[]", e.getExpected().getStringRepresentation());
- assertEquals("null", e.getActual().getStringRepresentation());
+ assertEquals("[]", e.getActual().getStringRepresentation());
assertTrue(e.getMessage().contains("Locator expected not to have text"), e.getMessage());
}
}
diff --git a/playwright/src/main/java/com/microsoft/playwright/Frame.java b/playwright/src/main/java/com/microsoft/playwright/Frame.java
index 1ad5245a..49ad9a3b 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Frame.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Frame.java
@@ -813,6 +813,7 @@ public interface Frame {
*
{@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -841,6 +842,7 @@ public interface Frame {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public NavigateOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -1455,6 +1457,7 @@ public interface Frame {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -1475,6 +1478,7 @@ public interface Frame {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public SetContentOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -1886,6 +1890,7 @@ public interface Frame {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -1933,6 +1938,7 @@ public interface Frame {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitForNavigationOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -2012,6 +2018,7 @@ public interface Frame {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -2032,6 +2039,7 @@ public interface Frame {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitForURLOptions setWaitUntil(WaitUntilState waitUntil) {
diff --git a/playwright/src/main/java/com/microsoft/playwright/Page.java b/playwright/src/main/java/com/microsoft/playwright/Page.java
index fb619bed..11430faa 100644
--- a/playwright/src/main/java/com/microsoft/playwright/Page.java
+++ b/playwright/src/main/java/com/microsoft/playwright/Page.java
@@ -1147,6 +1147,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -1167,6 +1168,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public GoBackOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -1188,6 +1190,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -1208,6 +1211,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public GoForwardOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -1234,6 +1238,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -1262,6 +1267,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public NavigateOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -1889,6 +1895,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -1909,6 +1916,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public ReloadOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -2195,6 +2203,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -2215,6 +2224,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public SetContentOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -2723,6 +2733,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -2770,6 +2781,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitForNavigationOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -2937,6 +2949,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitUntilState waitUntil;
@@ -2957,6 +2970,7 @@ public interface Page extends AutoCloseable {
* {@code "domcontentloaded"} - consider operation to be finished when the {@code DOMContentLoaded} event is fired.
* {@code "load"} - consider operation to be finished when the {@code load} event is fired.
* {@code "networkidle"} - consider operation to be finished when there are no network connections for at least {@code 500} ms.
+ * {@code "commit"} - consider operation to be finished when network response is received and the document started loading.
*
*/
public WaitForURLOptions setWaitUntil(WaitUntilState waitUntil) {
@@ -4542,15 +4556,15 @@ public interface Page extends AutoCloseable {
*/
List querySelectorAll(String selector);
/**
- * Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
- * last redirect.
+ * This method reloads the current page, in the same way as if the user had triggered a browser refresh. Returns the main
+ * resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
*/
default Response reload() {
return reload(null);
}
/**
- * Returns the main resource response. In case of multiple redirects, the navigation will resolve with the response of the
- * last redirect.
+ * This method reloads the current page, in the same way as if the user had triggered a browser refresh. Returns the main
+ * resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect.
*/
Response reload(ReloadOptions options);
/**
diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java
index ad4b00d9..7c98362a 100644
--- a/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java
+++ b/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java
@@ -31,7 +31,7 @@ import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.regex.Pattern;
-import static com.microsoft.playwright.options.LoadState.*;
+import static com.microsoft.playwright.options.WaitUntilState.*;
import static com.microsoft.playwright.impl.Serialization.*;
import static com.microsoft.playwright.impl.Utils.convertViaJson;
@@ -40,7 +40,7 @@ public class FrameImpl extends ChannelOwner implements Frame {
private String url;
FrameImpl parentFrame;
Set childFrames = new LinkedHashSet<>();
- private final Set loadStates = new HashSet<>();
+ private final Set loadStates = new HashSet<>();
enum InternalEventType { NAVIGATED, LOADSTATE }
private final ListenerCollection internalListeners = new ListenerCollection<>();
@@ -61,11 +61,12 @@ public class FrameImpl extends ChannelOwner implements Frame {
}
}
- private static LoadState loadStateFromProtocol(String value) {
+ private static WaitUntilState loadStateFromProtocol(String value) {
switch (value) {
case "load": return LOAD;
case "domcontentloaded": return DOMCONTENTLOADED;
case "networkidle": return NETWORKIDLE;
+ case "commit": return COMMIT;
default: throw new PlaywrightException("Unexpected value: " + value);
}
}
@@ -801,6 +802,10 @@ public class FrameImpl extends ChannelOwner implements Frame {
}
void waitForLoadStateImpl(LoadState state, WaitForLoadStateOptions options) {
+ waitForLoadStateImpl(convertViaJson(state, WaitUntilState.class), options);
+ }
+
+ private void waitForLoadStateImpl(WaitUntilState state, WaitForLoadStateOptions options) {
if (options == null) {
options = new WaitForLoadStateOptions();
}
@@ -815,11 +820,11 @@ public class FrameImpl extends ChannelOwner implements Frame {
runUntil(() -> {}, new WaitableRace<>(waitables));
}
- private class WaitForLoadStateHelper implements Waitable, Consumer {
- private final LoadState expectedState;
+ private class WaitForLoadStateHelper implements Waitable, Consumer {
+ private final WaitUntilState expectedState;
private boolean isDone;
- WaitForLoadStateHelper(LoadState state) {
+ WaitForLoadStateHelper(WaitUntilState state) {
expectedState = state;
isDone = loadStates.contains(state);
if (!isDone) {
@@ -828,7 +833,7 @@ public class FrameImpl extends ChannelOwner implements Frame {
}
@Override
- public void accept(LoadState state) {
+ public void accept(WaitUntilState state) {
if (expectedState.equals(state)) {
isDone = true;
dispose();
@@ -851,13 +856,13 @@ public class FrameImpl extends ChannelOwner implements Frame {
private class WaitForNavigationHelper implements Waitable, Consumer {
private final UrlMatcher matcher;
- private final LoadState expectedLoadState;
+ private final WaitUntilState expectedLoadState;
private WaitForLoadStateHelper loadStateHelper;
private RequestImpl request;
private RuntimeException exception;
- WaitForNavigationHelper(UrlMatcher matcher, LoadState expectedLoadState) {
+ WaitForNavigationHelper(UrlMatcher matcher, WaitUntilState expectedLoadState) {
this.matcher = matcher;
this.expectedLoadState = expectedLoadState;
internalListeners.add(InternalEventType.NAVIGATED, this);
@@ -935,7 +940,7 @@ public class FrameImpl extends ChannelOwner implements Frame {
if (matcher == null) {
matcher = UrlMatcher.forOneOf(page.context().baseUrl, options.url);
}
- waitables.add(new WaitForNavigationHelper(matcher, convertViaJson(options.waitUntil, LoadState.class)));
+ waitables.add(new WaitForNavigationHelper(matcher, options.waitUntil));
waitables.add(page.createWaitForCloseHelper());
waitables.add(page.createWaitableFrameDetach(this));
waitables.add(page.createWaitableNavigationTimeout(options.timeout));
@@ -1001,8 +1006,7 @@ public class FrameImpl extends ChannelOwner implements Frame {
options = new WaitForURLOptions();
}
if (matcher.test(url())) {
- waitForLoadStateImpl(convertViaJson(options.waitUntil, LoadState.class),
- convertViaJson(options, WaitForLoadStateOptions.class));
+ waitForLoadStateImpl(options.waitUntil, convertViaJson(options, WaitForLoadStateOptions.class));
return;
}
waitForNavigationImpl(() -> {}, convertViaJson(options, WaitForNavigationOptions.class), matcher);
@@ -1012,7 +1016,7 @@ public class FrameImpl extends ChannelOwner implements Frame {
if ("loadstate".equals(event)) {
JsonElement add = params.get("add");
if (add != null) {
- LoadState state = loadStateFromProtocol(add.getAsString());
+ WaitUntilState state = loadStateFromProtocol(add.getAsString());
loadStates.add(state);
internalListeners.notify(InternalEventType.LOADSTATE, state);
}
diff --git a/playwright/src/main/java/com/microsoft/playwright/options/WaitUntilState.java b/playwright/src/main/java/com/microsoft/playwright/options/WaitUntilState.java
index 77cd938e..36b90375 100644
--- a/playwright/src/main/java/com/microsoft/playwright/options/WaitUntilState.java
+++ b/playwright/src/main/java/com/microsoft/playwright/options/WaitUntilState.java
@@ -19,5 +19,6 @@ package com.microsoft.playwright.options;
public enum WaitUntilState {
LOAD,
DOMCONTENTLOADED,
- NETWORKIDLE
+ NETWORKIDLE,
+ COMMIT
}
\ No newline at end of file
diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageSetContent.java b/playwright/src/test/java/com/microsoft/playwright/TestPageSetContent.java
new file mode 100644
index 00000000..080b9079
--- /dev/null
+++ b/playwright/src/test/java/com/microsoft/playwright/TestPageSetContent.java
@@ -0,0 +1,124 @@
+/*
+ * 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 com.microsoft.playwright.options.WaitUntilState;
+import org.junit.jupiter.api.Test;
+
+import static com.microsoft.playwright.options.WaitUntilState.COMMIT;
+import static com.microsoft.playwright.options.WaitUntilState.DOMCONTENTLOADED;
+import static org.junit.jupiter.api.Assertions.*;
+
+public class TestPageSetContent extends TestBase {
+ private static final String expectedOutput = "hello
";
+
+ @Test
+ void shouldWork() {
+ page.setContent("hello
");
+ Object result = page.content();
+ assertEquals(expectedOutput, result);
+ }
+
+ @Test
+ void shouldWorkWithDomcontentloaded() {
+ page.setContent("hello
", new Page.SetContentOptions().setWaitUntil(DOMCONTENTLOADED));
+ Object result = page.content();
+ assertEquals(expectedOutput, result);
+ }
+
+ @Test
+ void shouldWorkWithCommit() {
+ page.setContent("hello
", new Page.SetContentOptions().setWaitUntil(COMMIT));
+ Object result = page.content();
+ assertEquals(expectedOutput, result);
+ }
+
+
+ @Test
+ void shouldWorkWithDoctype() {
+ String doctype = "";
+ page.setContent(doctype + "hello
");
+ Object result = page.content();
+ assertEquals(doctype + expectedOutput, result);
+ }
+
+ @Test
+ void shouldWorkWithHTML4Doctype() {
+ String doctype = "";
+ page.setContent(doctype + "hello
");
+ Object result = page.content();
+ assertEquals(doctype + expectedOutput, result);
+ }
+
+ @Test
+ void shouldRespectTimeout() {
+ String imgPath = "/img.png";
+ // stall for image
+ server.setRoute(imgPath, exchange -> {});
+ try {
+ page.setContent("
", new Page.SetContentOptions().setTimeout(100));
+ fail("did not throw");
+ } catch (TimeoutError e) {
+ }
+ }
+
+ @Test
+ void shouldRespectDefaultNavigationTimeout() {
+ page.setDefaultNavigationTimeout(100);
+ String imgPath = "/img.png";
+ // stall for image
+ server.setRoute(imgPath, exchange -> {});
+ try {
+ page.setContent("
");
+ fail("did not throw");
+ } catch (TimeoutError e) {
+ assertTrue(e.getMessage().contains("Timeout 100ms exceeded."), e.getMessage());
+ }
+ }
+
+ @Test
+ void shouldWorkFastEnough() {
+ for (int i = 0; i < 20; ++i) {
+ page.setContent("yo
");
+ }
+ }
+
+ @Test
+ void shouldWorkWithTrickyContent() {
+ page.setContent("hello world
" + "\\x7F");
+ assertEquals("hello world", page.evalOnSelector("div", "div => div.textContent"));
+ }
+
+ @Test
+ void shouldWorkWithAccents() {
+ page.setContent("aberración
");
+ assertEquals("aberración", page.evalOnSelector("div", "div => div.textContent"));
+ }
+
+ @Test
+ void shouldWorkWithEmojis() {
+ page.setContent("🐥
");
+ assertEquals("🐥", page.evalOnSelector("div", "div => div.textContent"));
+ }
+
+ @Test
+ void shouldWorkWithNewline() {
+ page.setContent("\n
");
+ assertEquals("\n", page.evalOnSelector("div", "div => div.textContent"));
+ }
+}
diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForNavigation.java b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForNavigation.java
index e5de4a32..9595cee3 100644
--- a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForNavigation.java
+++ b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForNavigation.java
@@ -19,12 +19,14 @@ package com.microsoft.playwright;
import com.microsoft.playwright.options.WaitUntilState;
import org.junit.jupiter.api.Test;
+import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.regex.Pattern;
import static com.microsoft.playwright.Utils.expectedSSLError;
+import static java.util.Collections.nCopies;
import static org.junit.jupiter.api.Assertions.*;
public class TestPageWaitForNavigation extends TestBase {
@@ -54,6 +56,23 @@ public class TestPageWaitForNavigation extends TestBase {
void shouldWorkWithBothDomcontentloadedAndLoad() {
}
+ @Test
+ void shouldWorkWithCommit() {
+ server.setRoute("/empty.html", exchange -> {
+ exchange.getResponseHeaders().add("Content-Type", "text/html");
+ exchange.sendResponseHeaders(200, 8192);
+ OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody());
+ writer.write("" + String.join("", nCopies(4100, "A")));
+ writer.flush();
+ });
+ page.waitForNavigation(new Page.WaitForNavigationOptions().setWaitUntil(WaitUntilState.COMMIT), () -> {
+ try {
+ page.navigate(server.EMPTY_PAGE, new Page.NavigateOptions().setTimeout(100));
+ } catch (TimeoutError e) {
+ }
+ });
+ }
+
@Test
void shouldWorkWithClickingOnAnchorLinks() {
page.navigate(server.EMPTY_PAGE);
diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForUrl.java b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForUrl.java
index f2a2e236..9755afe0 100644
--- a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForUrl.java
+++ b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForUrl.java
@@ -19,6 +19,11 @@ package com.microsoft.playwright;
import com.microsoft.playwright.options.WaitUntilState;
import org.junit.jupiter.api.Test;
+import java.io.OutputStreamWriter;
+import java.util.Collections;
+import java.util.concurrent.Semaphore;
+
+import static java.util.Collections.nCopies;
import static org.junit.jupiter.api.Assertions.*;
public class TestPageWaitForUrl extends TestBase {
@@ -47,6 +52,27 @@ public class TestPageWaitForUrl extends TestBase {
page.waitForURL("**/one-style.html", new Page.WaitForURLOptions().setWaitUntil(WaitUntilState.LOAD));
}
+ @Test
+ void shouldWorkWithCommit() {
+ server.setRoute("/empty.html", exchange -> {
+ exchange.getResponseHeaders().add("Content-Type", "text/html");
+ exchange.sendResponseHeaders(200, 8192);
+ OutputStreamWriter writer = new OutputStreamWriter(exchange.getResponseBody());
+ writer.write("" + String.join("", nCopies(4100, "A")));
+ writer.flush();
+ });
+ try {
+ page.navigate(server.EMPTY_PAGE, new Page.NavigateOptions().setTimeout(100));
+ } catch (TimeoutError e) {
+ }
+ page.waitForURL("**/empty.html", new Page.WaitForURLOptions().setWaitUntil(WaitUntilState.COMMIT));
+ }
+
+ @Test
+ void shouldWorkWithCommitAndAboutBlank() {
+ page.waitForURL("about:blank", new Page.WaitForURLOptions().setWaitUntil(WaitUntilState.COMMIT));
+ }
+
@Test
void shouldWorkWithClickingOnAnchorLinks() {
page.navigate(server.EMPTY_PAGE);
diff --git a/scripts/CLI_VERSION b/scripts/CLI_VERSION
index b8b348d1..ffc34e20 100644
--- a/scripts/CLI_VERSION
+++ b/scripts/CLI_VERSION
@@ -1 +1 @@
-1.17.0-next-1635526444000
+1.17.0-next-1635811939000