In this blog, you will learn how to create a Playwright Java project in the Eclipse IDE. You will also learn how to add the maven dependencies such as: Junit jupiter, Junit jupiter params, Junit playwright and JUnit Jupiter Engine. Additionally, you will configure JavaSE-1-1.8 and create a Java maven playwright project in eclipse.
Topics that we will cover:
- Create maven Playwright project
- Add maven dependencies:
‘JUnit Jupiter’,
‘JUnit Jupiter params’,
‘JUnit Jupiter Engine’,
‘Playwright’ - Configure JavaSE-1.8
Create maven Playwright project
File > New > ‘Maven Project’

Select ‘Create a simple project’ option

Click Next, enter ‘Group Id’ and ‘Artifact Id’

Click Finish.
‘M’ represents maven project

Refresh the maven project to see the folder structure

Add maven dependency for ‘JUnit Jupiter’
The ‘JUnit Jupiter’ maven dependency can be found in the official maven site https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
This dependency is needed to write the JUnit tests

Copy/paste the above dependency in dependencies section of pom.xml

Save xml. This will automatically download JUnit dependencies.
‘Maven Dependencies’ folder would now show the added junit jars

Add maven dependency for ‘JUnit Jupiter Params’
Similarly let us add ‘JUnit Jupiter Params’ dependency
https://mvnrepository.com/search?q=Junit+Jupiter+Params
This dependency is needed to run the parametrized tests

Save xml

Add maven dependency for ‘Playwright’
Similarly let us add playwright dependency


Save xml to automatically download playwright jars

Add maven dependency for ‘JUnit Jupiter Engine’
Similarly let us add ‘JUnit Jupiter Engine’ dependency
https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine
If you don’t add this dependency, you might get below exception while executing playwright tests:
java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineExecutionListener

Save xml to download the Jupiter-engine jar

JavaSE-1.8 configuration
If you are getting an error: ‘References to static interface methods are allowed only at source level 1.8 or above’, than perform below steps:
Right click project > click properties and further click ‘Java Build Path’ > click libraries and select ‘JRE System Library’ > click ‘Edit’ and select ‘JavaSE-1.8 (jre1.8.0)’

Click ‘Finish’, ‘Apply and close’ > ‘JRE System Library [JavaSE-1.8]’ should now be seen

We have done the playwright project setup.
In our next blog, we will create and execute the first playwright java program.
Thank you for reading!