All of us love Selenium; however, it can only be used to test the applications on the browser. If you are working on a company that requires you to run multiple types of technology, it would be great if we can run a selenium test, scripts and Unit using one IDE.
So here’s a step-by-step guide on running Selenium test cases using Java. In this article, we divided the procedures into simple and tiny steps that will help you understand the whole process. This will help you start the automation testing; you will also understand how to run your first ever selenium test using Java.
Download Java and Install it in Your System
Before you begin on running your selenium test, you need to ensure first that you have a Java installed in your system. The java program that is compatible with your system is found on the official site of java. After completing the download process, simply open the application and just follow the set-up procedure to install the program. For Mac users, java should already be available in your system.
Eclipse is a software that it written entirely on Java platform. It has a support that comes in multiple languages. In this article, we will be utilizing the program Eclipse to write your code and run your selenium test cases. Ensure that you are downloading the Eclipse that is compatible with your system. You will be getting a .zip file, extract the file on a specific folder. You don’t need to install the program.
Download a Client Driver
The client driver for the Selenium test is available in various programming languages such as Python, Ruby Rails, C#, and Java. You will have to download the client driver in java language. Extract the file into the C directory. The Jar files that are extracted in this folder will be automatically imported in Eclipse.
Run the Eclipse program and select your workspace. The workspace is basically the place where the eclipse projects will be saved. After clicking OK, the first step is to start a new Java Project. You may enter the project name as ‘Selenium Java’. Under the new Java project, you will notice a src folder where you can create class. If you do this properly, it will direct you to a new window. Right-click on the name of your project then choose properties. One the left portion of the dialog box, choose ‘Java Build path’. Go to the Libraries tab and Click the ‘Add External Jar’ option. Choose the location of your the Driver client of your Selenium test.
After completing the steps above, it is now time to execute your selenium test cases. Simply copy your script and paste it and then click the run option. Running your selenium test using Java is quite interesting. You will appreciate the information presented on this module that will help you in using the automation testing.