Skip to content

Commit 7c07387

Browse files
authored
docs: update examples to use 0.170.3 (#158)
1 parent 4303a7e commit 7c07387

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,13 @@ Playwright supports Java 8 and above.
2222

2323
Playwright is distributed as a set of [Maven](https://maven.apache.org/what-is-maven.html) modules. The easiest way to use it is to add a couple of dependencies to your Maven `pom.xml` file as described below. If you're not familiar with Maven please refer to its [documentation](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html).
2424

25-
To run Playwright simply add two dependencies to your Maven project:
25+
To run Playwright simply add following dependency to your Maven project:
2626

2727
```xml
2828
<dependency>
2929
<groupId>com.microsoft.playwright</groupId>
3030
<artifactId>playwright</artifactId>
31-
<version>0.170.2</version>
32-
</dependency>
33-
<dependency>
34-
<groupId>com.microsoft.playwright</groupId>
35-
<artifactId>driver-bundle</artifactId>
36-
<version>0.170.2</version>
31+
<version>0.170.3</version>
3732
</dependency>
3833
```
3934

@@ -87,14 +82,10 @@ public class MobileAndGeolocation {
8782
public static void main(String[] args) throws Exception {
8883
Playwright playwright = Playwright.create();
8984
BrowserType browserType = playwright.chromium();
90-
Browser browser = browserType.launch();
85+
Browser browser = browserType.launch(new BrowserType.LaunchOptions().withHeadless(false));
9186
DeviceDescriptor pixel2 = playwright.devices().get("Pixel 2");
9287
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
93-
.withViewport(pixel2.viewport().width(), pixel2.viewport().height())
94-
.withUserAgent(pixel2.userAgent())
95-
.withDeviceScaleFactor(pixel2.deviceScaleFactor())
96-
.withIsMobile(pixel2.isMobile())
97-
.withHasTouch(pixel2.hasTouch())
88+
.withDevice(pixel2)
9889
.withLocale("en-US")
9990
.withGeolocation(new Geolocation(41.889938, 12.492507))
10091
.withPermissions(asList("geolocation")));

examples/pom.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@
1212
<dependency>
1313
<groupId>com.microsoft.playwright</groupId>
1414
<artifactId>playwright</artifactId>
15-
<version>0.170.2</version>
16-
</dependency>
17-
<dependency>
18-
<groupId>com.microsoft.playwright</groupId>
19-
<artifactId>driver-bundle</artifactId>
20-
<version>0.170.2</version>
15+
<version>0.170.3</version>
2116
</dependency>
2217
</dependencies>
2318
<build>

examples/src/main/java/org/example/MobileAndGeolocation.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,10 @@ public class MobileAndGeolocation {
2626
public static void main(String[] args) throws Exception {
2727
Playwright playwright = Playwright.create();
2828
BrowserType browserType = playwright.chromium();
29-
Browser browser = browserType.launch();
29+
Browser browser = browserType.launch(new BrowserType.LaunchOptions().withHeadless(false));
3030
DeviceDescriptor pixel2 = playwright.devices().get("Pixel 2");
3131
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
32-
.withViewport(pixel2.viewport().width(), pixel2.viewport().height())
33-
.withUserAgent(pixel2.userAgent())
34-
.withDeviceScaleFactor(pixel2.deviceScaleFactor())
35-
.withIsMobile(pixel2.isMobile())
36-
.withHasTouch(pixel2.hasTouch())
32+
.withDevice(pixel2)
3733
.withLocale("en-US")
3834
.withGeolocation(new Geolocation(41.889938, 12.492507))
3935
.withPermissions(asList("geolocation")));

0 commit comments

Comments
 (0)