How to make seleinum jar file , and how to test using Selenium jar file?


We can make a JAR file with the code created in Selenium and share it among others. The procedure to make a Selenium Jar file and to test it are listed in the below steps −

Step1 − Right-click on the Selenium project and click on Export.

Step2 − Select the option Runnable Jar under the Java folder. Then click on Next.

Step3 − Select the Java class for which we want to create a JAR in the Launch Configurations field. Enter the Export destination: field and select the option Extract required libraries into generated JAR. Then click on Finish.

Step4 − Click on the OK button available on the Runnable JAR File Export pop-up.

Step5 − The complete code of the project is converted into a JAR file and gets stored in the destination specified in the Step3.

Step6 − To test the JAR created, open the terminal and first navigate from the current directory to the path of the directory where the JAR is saved.

Step7 − Run the command: java -jar <JAR filename>.jar

Here, we have used the command java -jar Selenium Jar.jar to test our JAR.

Updated on: 29-Jun-2021

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements