Skip to content

Commit 915ee8d

Browse files
authored
chore: roll 1.54.0-alpha-2025-07-09 (#1817)
1 parent 9df2165 commit 915ee8d

24 files changed

+169
-53
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
1010

1111
| | Linux | macOS | Windows |
1212
| :--- | :---: | :---: | :---: |
13-
| Chromium <!-- GEN:chromium-version -->138.0.7204.23<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13+
| Chromium <!-- GEN:chromium-version -->139.0.7258.5<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1414
| WebKit <!-- GEN:webkit-version -->18.5<!-- GEN:stop --> ||||
15-
| Firefox <!-- GEN:firefox-version -->139.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
15+
| Firefox <!-- GEN:firefox-version -->140.0.2<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1616

1717
## Documentation
1818

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<name>Playwright Client Examples</name>
1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13-
<playwright.version>1.53.0</playwright.version>
13+
<playwright.version>1.54.0</playwright.version>
1414
</properties>
1515
<dependencies>
1616
<dependency>

playwright/src/main/java/com/microsoft/playwright/BrowserContext.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,8 @@ public WaitForPageOptions setTimeout(double timeout) {
596596
*/
597597
List<Page> backgroundPages();
598598
/**
599-
* Returns the browser instance of the context. If it was launched as a persistent context null gets returned.
599+
* Gets the browser instance that owns the context. Returns {@code null} if the context is created outside of normal
600+
* browser, e.g. Android or Electron.
600601
*
601602
* @since v1.8
602603
*/
@@ -871,6 +872,7 @@ default void exposeBinding(String name, BindingCallback callback) {
871872
* <li> {@code "notifications"}</li>
872873
* <li> {@code "payment-handler"}</li>
873874
* <li> {@code "storage-access"}</li>
875+
* <li> {@code "local-fonts"}</li>
874876
* </ul>
875877
* @since v1.8
876878
*/
@@ -903,6 +905,7 @@ default void grantPermissions(List<String> permissions) {
903905
* <li> {@code "notifications"}</li>
904906
* <li> {@code "payment-handler"}</li>
905907
* <li> {@code "storage-access"}</li>
908+
* <li> {@code "local-fonts"}</li>
906909
* </ul>
907910
* @since v1.8
908911
*/

playwright/src/main/java/com/microsoft/playwright/Mouse.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
/**
2222
* The Mouse class operates in main-frame CSS pixels relative to the top-left corner of the viewport.
2323
*
24+
* <p> <strong>NOTE:</strong> If you want to debug where the mouse moved, you can use the <a
25+
* href="https://playwright.dev/java/docs/trace-viewer-intro">Trace viewer</a> or <a
26+
* href="https://playwright.dev/java/docs/running-tests">Playwright Inspector</a>. A red dot showing the location of the
27+
* mouse will be shown for every mouse action.
28+
*
2429
* <p> Every {@code page} object has its own Mouse, accessible with {@link com.microsoft.playwright.Page#mouse Page.mouse()}.
2530
* <pre>{@code
2631
* // Using ‘page.mouse’ to trace a 100x100 square.

playwright/src/main/java/com/microsoft/playwright/impl/AssertionsBase.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.microsoft.playwright.impl;
1818

19-
import com.microsoft.playwright.PlaywrightException;
2019
import org.opentest4j.AssertionFailedError;
2120
import org.opentest4j.ValueWrapper;
2221

@@ -29,12 +28,10 @@
2928
import static com.microsoft.playwright.impl.Utils.toJsRegexFlags;
3029
import static java.util.Arrays.asList;
3130

32-
class AssertionsBase {
33-
final LocatorImpl actualLocator;
31+
abstract class AssertionsBase {
3432
final boolean isNot;
3533

36-
AssertionsBase(LocatorImpl actual, boolean isNot) {
37-
this.actualLocator = actual;
34+
AssertionsBase(boolean isNot) {
3835
this.isNot = isNot;
3936
}
4037

@@ -58,7 +55,7 @@ void expectImpl(String expression, FrameExpectOptions expectOptions, Object expe
5855
if (isNot) {
5956
message = message.replace("expected to", "expected not to");
6057
}
61-
FrameExpectResult result = actualLocator.expect(expression, expectOptions, title);
58+
FrameExpectResult result = doExpect(expression, expectOptions, title);
6259
if (result.matches == isNot) {
6360
Object actual = result.received == null ? null : Serialization.deserialize(result.received);
6461
String log = (result.log == null) ? "" : String.join("\n", result.log);
@@ -75,7 +72,9 @@ void expectImpl(String expression, FrameExpectOptions expectOptions, Object expe
7572
}
7673
}
7774

78-
private static ValueWrapper formatValue(Object value) {
75+
abstract FrameExpectResult doExpect(String expression, FrameExpectOptions expectOptions, String title);
76+
77+
protected static ValueWrapper formatValue(Object value) {
7978
if (value == null || !value.getClass().isArray()) {
8079
return ValueWrapper.create(value);
8180
}

playwright/src/main/java/com/microsoft/playwright/impl/BrowserContextImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ private void routeWebSocketImpl(UrlMatcher matcher, Consumer<WebSocketRoute> han
506506

507507
void recordIntoHar(PageImpl page, Path har, RouteFromHAROptions options, HarContentPolicy contentPolicy) {
508508
if (contentPolicy == null) {
509-
contentPolicy = Utils.convertType(options.updateContent, HarContentPolicy.class);;
509+
contentPolicy = Utils.convertType(options.updateContent, HarContentPolicy.class);
510510
}
511511
if (contentPolicy == null) {
512512
contentPolicy = HarContentPolicy.ATTACH;

playwright/src/main/java/com/microsoft/playwright/impl/ConsoleMessageImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
import com.google.gson.JsonObject;
2121
import com.microsoft.playwright.ConsoleMessage;
2222
import com.microsoft.playwright.JSHandle;
23-
import com.microsoft.playwright.Page;
2423

2524
import java.util.ArrayList;
2625
import java.util.List;
2726

28-
import static com.microsoft.playwright.impl.Serialization.gson;
29-
3027
public class ConsoleMessageImpl implements ConsoleMessage {
3128
private final Connection connection;
3229
private PageImpl page;

playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,8 @@ ElementHandle waitForSelectorImpl(String selector, WaitForSelectorOptions option
993993
@Override
994994
public void waitForTimeout(double timeout) {
995995
JsonObject params = new JsonObject();
996-
sendMessage("waitForTimeout", params, timeout);
996+
params.addProperty("waitTimeout", timeout);
997+
sendMessage("waitForTimeout", params, NO_TIMEOUT);
997998
}
998999

9991000
@Override
@@ -1085,4 +1086,16 @@ protected double navigationTimeout(Double timeout) {
10851086
}
10861087
return new TimeoutSettings().navigationTimeout(timeout);
10871088
}
1089+
1090+
FrameExpectResult expect(String expression, FrameExpectOptions options, String title) {
1091+
return withTitle(title, () -> expect(expression, options));
1092+
}
1093+
1094+
FrameExpectResult expect(String expression, FrameExpectOptions options) {
1095+
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
1096+
params.addProperty("expression", expression);
1097+
JsonElement json = sendMessage("expect", params, options.timeout);
1098+
FrameExpectResult result = gson().fromJson(json, FrameExpectResult.class);
1099+
return result;
1100+
}
10881101
}

playwright/src/main/java/com/microsoft/playwright/impl/LocatorAssertionsImpl.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,20 @@
3030
import static com.microsoft.playwright.impl.Utils.convertType;
3131

3232
public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAssertions {
33+
LocatorImpl actualLocator;
34+
3335
public LocatorAssertionsImpl(Locator locator) {
3436
this(locator, false);
3537
}
3638

3739
private LocatorAssertionsImpl(Locator locator, boolean isNot) {
38-
super((LocatorImpl) locator, isNot);
40+
super(isNot);
41+
this.actualLocator = (LocatorImpl) locator;
42+
}
43+
44+
@Override
45+
FrameExpectResult doExpect(String expression, FrameExpectOptions expectOptions, String title) {
46+
return actualLocator.expect(expression, expectOptions, title);
3947
}
4048

4149

playwright/src/main/java/com/microsoft/playwright/impl/LocatorImpl.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,8 @@ public int hashCode() {
645645
}
646646

647647
FrameExpectResult expect(String expression, FrameExpectOptions options, String title) {
648-
return frame.withTitle(title, () -> expectImpl(expression, options));
648+
options.selector = selector;
649+
return frame.expect(expression, options, title);
649650
}
650651

651652
JsonObject toProtocol() {
@@ -654,13 +655,4 @@ JsonObject toProtocol() {
654655
result.addProperty("selector", selector);
655656
return result;
656657
}
657-
658-
private FrameExpectResult expectImpl(String expression, FrameExpectOptions options) {
659-
JsonObject params = gson().toJsonTree(options).getAsJsonObject();
660-
params.addProperty("selector", selector);
661-
params.addProperty("expression", expression);
662-
JsonElement json = frame.sendMessage("expect", params, options.timeout);
663-
FrameExpectResult result = gson().fromJson(json, FrameExpectResult.class);
664-
return result;
665-
}
666658
}

0 commit comments

Comments
 (0)