Skip to content

Commit 6e66ee7

Browse files
authored
chore: roll 1.49-beta (#1697)
1 parent 4bda800 commit 6e66ee7

32 files changed

+728
-240
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
run: scripts/download_driver.sh
3131
- name: Build & Install
3232
run: mvn -B install -D skipTests --no-transfer-progress
33+
- name: Install browsers
34+
run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps" -f playwright/pom.xml
3335
- name: Run tests
3436
run: mvn test --no-transfer-progress --fail-at-end -D org.slf4j.simpleLogger.showDateTime=true -D org.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss
3537
env:
@@ -78,6 +80,8 @@ jobs:
7880
run: scripts/download_driver.sh
7981
- name: Build & Install
8082
run: mvn -B install -D skipTests --no-transfer-progress
83+
- name: Install browsers
84+
run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps" -f playwright/pom.xml
8185
- name: Install MS Edge
8286
if: matrix.browser-channel == 'msedge' && matrix.os == 'macos-latest'
8387
shell: bash
@@ -108,6 +112,8 @@ jobs:
108112
run: scripts/download_driver.sh
109113
- name: Build & Install
110114
run: mvn -B install -D skipTests --no-transfer-progress
115+
- name: Install browsers
116+
run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps" -f playwright/pom.xml
111117
- name: Run tests
112118
run: mvn test --no-transfer-progress --fail-at-end
113119
env:

.github/workflows/verify_api.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ jobs:
2525
run: scripts/download_driver.sh
2626
- name: Regenerate APIs
2727
run: scripts/generate_api.sh
28+
- name: Build & Install
29+
run: mvn -B install -D skipTests --no-transfer-progress
30+
- name: Install browsers
31+
run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps" -f playwright/pom.xml
2832
- name: Update browser versions in README
2933
run: scripts/update_readme.sh
3034
- name: Verify API is up to date

README.md

Lines changed: 3 additions & 3 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 -->130.0.6723.31<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
14-
| WebKit <!-- GEN:webkit-version -->18.0<!-- GEN:stop --> ||||
15-
| Firefox <!-- GEN:firefox-version -->131.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
13+
| Chromium <!-- GEN:chromium-version -->131.0.6778.33<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
14+
| WebKit <!-- GEN:webkit-version -->18.2<!-- GEN:stop --> ||||
15+
| Firefox <!-- GEN:firefox-version -->132.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
1616

1717
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.
1818

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

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
* import com.microsoft.playwright.*;
3030
*
3131
* public class Example {
32-
* public static void main(String[] args) {
33-
* try (Playwright playwright = Playwright.create()) {
34-
* BrowserType firefox = playwright.firefox()
35-
* Browser browser = firefox.launch();
36-
* Page page = browser.newPage();
37-
* page.navigate('https://example.com');
38-
* browser.close();
39-
* }
40-
* }
32+
* public static void main(String[] args) {
33+
* try (Playwright playwright = Playwright.create()) {
34+
* BrowserType firefox = playwright.firefox();
35+
* Browser browser = firefox.launch();
36+
* Page page = browser.newPage();
37+
* page.navigate("https://example.com");
38+
* browser.close();
39+
* }
40+
* }
4141
* }
4242
* }</pre>
4343
*/
@@ -111,9 +111,11 @@ class NewContextOptions {
111111
*/
112112
public List<ClientCertificate> clientCertificates;
113113
/**
114-
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
115-
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
116-
* {@code null} resets emulation to system defaults. Defaults to {@code "light"}.
114+
* Emulates <a
115+
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">prefers-colors-scheme</a> media
116+
* feature, supported values are {@code "light"} and {@code "dark"}. See {@link com.microsoft.playwright.Page#emulateMedia
117+
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code
118+
* "light"}.
117119
*/
118120
public Optional<ColorScheme> colorScheme;
119121
/**
@@ -323,9 +325,11 @@ public NewContextOptions setClientCertificates(List<ClientCertificate> clientCer
323325
return this;
324326
}
325327
/**
326-
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
327-
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
328-
* {@code null} resets emulation to system defaults. Defaults to {@code "light"}.
328+
* Emulates <a
329+
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">prefers-colors-scheme</a> media
330+
* feature, supported values are {@code "light"} and {@code "dark"}. See {@link com.microsoft.playwright.Page#emulateMedia
331+
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code
332+
* "light"}.
329333
*/
330334
public NewContextOptions setColorScheme(ColorScheme colorScheme) {
331335
this.colorScheme = Optional.ofNullable(colorScheme);
@@ -660,9 +664,11 @@ class NewPageOptions {
660664
*/
661665
public List<ClientCertificate> clientCertificates;
662666
/**
663-
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
664-
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
665-
* {@code null} resets emulation to system defaults. Defaults to {@code "light"}.
667+
* Emulates <a
668+
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">prefers-colors-scheme</a> media
669+
* feature, supported values are {@code "light"} and {@code "dark"}. See {@link com.microsoft.playwright.Page#emulateMedia
670+
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code
671+
* "light"}.
666672
*/
667673
public Optional<ColorScheme> colorScheme;
668674
/**
@@ -872,9 +878,11 @@ public NewPageOptions setClientCertificates(List<ClientCertificate> clientCertif
872878
return this;
873879
}
874880
/**
875-
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
876-
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
877-
* {@code null} resets emulation to system defaults. Defaults to {@code "light"}.
881+
* Emulates <a
882+
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">prefers-colors-scheme</a> media
883+
* feature, supported values are {@code "light"} and {@code "dark"}. See {@link com.microsoft.playwright.Page#emulateMedia
884+
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code
885+
* "light"}.
878886
*/
879887
public NewPageOptions setColorScheme(ColorScheme colorScheme) {
880888
this.colorScheme = Optional.ofNullable(colorScheme);
@@ -1289,7 +1297,7 @@ default void close() {
12891297
* BrowserContext context = browser.newContext();
12901298
* // Create a new page in a pristine context.
12911299
* Page page = context.newPage();
1292-
* page.navigate('https://example.com');
1300+
* page.navigate("https://example.com");
12931301
*
12941302
* // Graceful close up everything
12951303
* context.close();
@@ -1316,7 +1324,7 @@ default BrowserContext newContext() {
13161324
* BrowserContext context = browser.newContext();
13171325
* // Create a new page in a pristine context.
13181326
* Page page = context.newPage();
1319-
* page.navigate('https://example.com');
1327+
* page.navigate("https://example.com");
13201328
*
13211329
* // Graceful close up everything
13221330
* context.close();
@@ -1364,7 +1372,7 @@ default Page newPage() {
13641372
* <pre>{@code
13651373
* browser.startTracing(page, new Browser.StartTracingOptions()
13661374
* .setPath(Paths.get("trace.json")));
1367-
* page.goto('https://www.google.com');
1375+
* page.navigate("https://www.google.com");
13681376
* browser.stopTracing();
13691377
* }</pre>
13701378
*
@@ -1388,7 +1396,7 @@ default void startTracing(Page page) {
13881396
* <pre>{@code
13891397
* browser.startTracing(page, new Browser.StartTracingOptions()
13901398
* .setPath(Paths.get("trace.json")));
1391-
* page.goto('https://www.google.com');
1399+
* page.navigate("https://www.google.com");
13921400
* browser.stopTracing();
13931401
* }</pre>
13941402
*
@@ -1411,7 +1419,7 @@ default void startTracing() {
14111419
* <pre>{@code
14121420
* browser.startTracing(page, new Browser.StartTracingOptions()
14131421
* .setPath(Paths.get("trace.json")));
1414-
* page.goto('https://www.google.com');
1422+
* page.navigate("https://www.google.com");
14151423
* browser.stopTracing();
14161424
* }</pre>
14171425
*

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ default List<Cookie> cookies() {
701701
* public class Example {
702702
* public static void main(String[] args) {
703703
* try (Playwright playwright = Playwright.create()) {
704-
* BrowserType webkit = playwright.webkit()
704+
* BrowserType webkit = playwright.webkit();
705705
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
706706
* BrowserContext context = browser.newContext();
707707
* context.exposeBinding("pageURL", (source, args) -> source.page().url());
@@ -748,7 +748,7 @@ default void exposeBinding(String name, BindingCallback callback) {
748748
* public class Example {
749749
* public static void main(String[] args) {
750750
* try (Playwright playwright = Playwright.create()) {
751-
* BrowserType webkit = playwright.webkit()
751+
* BrowserType webkit = playwright.webkit();
752752
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
753753
* BrowserContext context = browser.newContext();
754754
* context.exposeBinding("pageURL", (source, args) -> source.page().url());
@@ -797,8 +797,9 @@ default void exposeBinding(String name, BindingCallback callback) {
797797
* public class Example {
798798
* public static void main(String[] args) {
799799
* try (Playwright playwright = Playwright.create()) {
800-
* BrowserType webkit = playwright.webkit()
800+
* BrowserType webkit = playwright.webkit();
801801
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
802+
* BrowserContext context = browser.newContext();
802803
* context.exposeFunction("sha256", args -> {
803804
* String text = (String) args[0];
804805
* MessageDigest crypto;

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,11 @@ class LaunchPersistentContextOptions {
470470
*/
471471
public List<ClientCertificate> clientCertificates;
472472
/**
473-
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
474-
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
475-
* {@code null} resets emulation to system defaults. Defaults to {@code "light"}.
473+
* Emulates <a
474+
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">prefers-colors-scheme</a> media
475+
* feature, supported values are {@code "light"} and {@code "dark"}. See {@link com.microsoft.playwright.Page#emulateMedia
476+
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code
477+
* "light"}.
476478
*/
477479
public Optional<ColorScheme> colorScheme;
478480
/**
@@ -774,9 +776,11 @@ public LaunchPersistentContextOptions setClientCertificates(List<ClientCertifica
774776
return this;
775777
}
776778
/**
777-
* Emulates {@code "prefers-colors-scheme"} media feature, supported values are {@code "light"}, {@code "dark"}, {@code
778-
* "no-preference"}. See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing
779-
* {@code null} resets emulation to system defaults. Defaults to {@code "light"}.
779+
* Emulates <a
780+
* href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">prefers-colors-scheme</a> media
781+
* feature, supported values are {@code "light"} and {@code "dark"}. See {@link com.microsoft.playwright.Page#emulateMedia
782+
* Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code
783+
* "light"}.
780784
*/
781785
public LaunchPersistentContextOptions setColorScheme(ColorScheme colorScheme) {
782786
this.colorScheme = Optional.ofNullable(colorScheme);

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ default void install() {
227227
/**
228228
* Makes {@code Date.now} and {@code new Date()} return fixed fake time at all times, keeps all the timers running.
229229
*
230+
* <p> Use this method for simple scenarios where you only need to test with a predefined time. For more advanced scenarios,
231+
* use {@link com.microsoft.playwright.Clock#install Clock.install()} instead. Read docs on <a
232+
* href="https://playwright.dev/java/docs/clock">clock emulation</a> to learn more.
233+
*
230234
* <p> <strong>Usage</strong>
231235
* <pre>{@code
232236
* page.clock().setFixedTime(new Date());
@@ -241,6 +245,10 @@ default void install() {
241245
/**
242246
* Makes {@code Date.now} and {@code new Date()} return fixed fake time at all times, keeps all the timers running.
243247
*
248+
* <p> Use this method for simple scenarios where you only need to test with a predefined time. For more advanced scenarios,
249+
* use {@link com.microsoft.playwright.Clock#install Clock.install()} instead. Read docs on <a
250+
* href="https://playwright.dev/java/docs/clock">clock emulation</a> to learn more.
251+
*
244252
* <p> <strong>Usage</strong>
245253
* <pre>{@code
246254
* page.clock().setFixedTime(new Date());
@@ -255,6 +263,10 @@ default void install() {
255263
/**
256264
* Makes {@code Date.now} and {@code new Date()} return fixed fake time at all times, keeps all the timers running.
257265
*
266+
* <p> Use this method for simple scenarios where you only need to test with a predefined time. For more advanced scenarios,
267+
* use {@link com.microsoft.playwright.Clock#install Clock.install()} instead. Read docs on <a
268+
* href="https://playwright.dev/java/docs/clock">clock emulation</a> to learn more.
269+
*
258270
* <p> <strong>Usage</strong>
259271
* <pre>{@code
260272
* page.clock().setFixedTime(new Date());
@@ -267,7 +279,8 @@ default void install() {
267279
*/
268280
void setFixedTime(Date time);
269281
/**
270-
* Sets current system time but does not trigger any timers.
282+
* Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for example
283+
* switching from summer to winter time, or changing time zones.
271284
*
272285
* <p> <strong>Usage</strong>
273286
* <pre>{@code
@@ -281,7 +294,8 @@ default void install() {
281294
*/
282295
void setSystemTime(long time);
283296
/**
284-
* Sets current system time but does not trigger any timers.
297+
* Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for example
298+
* switching from summer to winter time, or changing time zones.
285299
*
286300
* <p> <strong>Usage</strong>
287301
* <pre>{@code
@@ -295,7 +309,8 @@ default void install() {
295309
*/
296310
void setSystemTime(String time);
297311
/**
298-
* Sets current system time but does not trigger any timers.
312+
* Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for example
313+
* switching from summer to winter time, or changing time zones.
299314
*
300315
* <p> <strong>Usage</strong>
301316
* <pre>{@code

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
* });
4040
*
4141
* // Deconstruct console.log arguments
42-
* msg.args().get(0).jsonValue() // hello
43-
* msg.args().get(1).jsonValue() // 42
42+
* msg.args().get(0).jsonValue(); // hello
43+
* msg.args().get(1).jsonValue(); // 42
4444
* }</pre>
4545
*/
4646
public interface ConsoleMessage {

0 commit comments

Comments
 (0)