In this section will discuss the steps on recording using Playwright using Java.
1. Create a Maven Project
2. Add below dependencies
<dependencies>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.54.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<mainClass>com.microsoft.playwright.CLI</mainClass>
</configuration>
</plugin>
</plugins>
</build>
3. Now navigate to the project from command prompt & run below commandmvn exec:java -P run-cli -Dexec.args="codegen <URL>"e.g. mvn exec:java -P run-cli -Dexec.args="codegen https://google.com"4. Do whatever you want on the page & same will be recorded in a Playwright tab5. You can get the generated code in different language/framework.
Links: https://www.youtube.com/watch?v=gtjntwOPz3s&t=2337s