playwright integration

This commit is contained in:
Joe DeFilippo 2023-09-04 00:24:34 -04:00
parent 4926e29270
commit d932479bef
10 changed files with 41 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.37.0</version>
</dependency>
</dependencies>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>

View file

@ -0,0 +1,14 @@
package com.example;
import com.microsoft.playwright.*;
import java.nio.file.Paths;
public class Main {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.webkit().launch();
Page page = browser.newPage();
page.navigate("https://playwright.dev/");
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("example.png")));
}
}
}

Binary file not shown.

View file

@ -0,0 +1,3 @@
artifactId=demo
groupId=com.example
version=1.0-SNAPSHOT

View file

@ -0,0 +1 @@
C:\dev\spring-petclinic2\src\test\playwright\demo\src\main\java\com\example\Main.java