File tree Expand file tree Collapse file tree 3 files changed +58
-1
lines changed
src/test/java/com/serenitydojo/playwright Expand file tree Collapse file tree 3 files changed +58
-1
lines changed Original file line number Diff line number Diff line change 11# playwright-in-java-sample-code
2- Sample code for the Serenity Dojo Playwright In Java course
2+ Sample code for the Serenity Dojo Playwright In Java course.
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5+ <modelVersion >4.0.0</modelVersion >
6+
7+ <groupId >org.example</groupId >
8+ <artifactId >my-first-playwright-test</artifactId >
9+ <version >1.0-SNAPSHOT</version >
10+
11+ <properties >
12+ <maven .compiler.source>17</maven .compiler.source>
13+ <maven .compiler.target>17</maven .compiler.target>
14+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
15+ </properties >
16+
17+ <dependencies >
18+ <dependency >
19+ <groupId >com.microsoft.playwright</groupId >
20+ <artifactId >playwright</artifactId >
21+ <version >1.47.0</version >
22+ <scope >test</scope >
23+ </dependency >
24+ <dependency >
25+ <groupId >org.junit.jupiter</groupId >
26+ <artifactId >junit-jupiter</artifactId >
27+ <version >5.11.1</version >
28+ <scope >test</scope >
29+ </dependency >
30+ </dependencies >
31+
32+ </project >
Original file line number Diff line number Diff line change 1+ package com .serenitydojo .playwright ;
2+
3+ import com .microsoft .playwright .Browser ;
4+ import com .microsoft .playwright .Page ;
5+ import com .microsoft .playwright .Playwright ;
6+ import org .junit .jupiter .api .Assertions ;
7+ import org .junit .jupiter .api .Test ;
8+
9+ public class ASimplePlaywrightTest {
10+
11+ @ Test
12+ void shouldShowThePageTitle () {
13+ Playwright playwright = Playwright .create ();
14+ Browser browser = playwright .chromium ().launch ();
15+ Page page = browser .newPage ();
16+
17+ page .navigate ("https://practicesoftwaretesting.com" );
18+ String title = page .title ();
19+
20+ Assertions .assertTrue (title .contains ("Practice Software Testing" ));
21+
22+ browser .close ();
23+ playwright .close ();
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments