How to set up Selenium WebDriver in Eclispe IDE on Linux?
Pre-requisites:
- Eclipse is installed
- Java is installed and Environment path is correctly set.
Steps to be followed:
- Launch Eclipse
- Create a Java Project
- Create a Package under "src" folder.
- Create a class inside the package
How to verify Java is installed and check the version?
- Open terminal or press Ctrl + Alt + t on your keyboard.
- Type - javac -version and hit enter.
- If java is installed, the output will be something like -
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
Launching Eclipse
- After installing eclipse, one folder with name "eclipse" will get created.
- Go to that folder and look for executable file named "eclipse" and double click on it to launch eclipse.
- When this screen comes, it allows you to create a workspace and to choose a path for your workspace. Once you're ready click "Launch".
- Once you clicked on launch, Eclipse will starts launching with the workspace selected in the above step.
- You would see this window once your workspace is loaded completely. Here you can see quick links on left side under "Project Explorer" tab.
Create a Project
- Now click on "Create a project" quick link. A "New Project" window will open up which lets you select the type of project which you wish to create.
- Click on "Java Project" and click on "Next".
- On clicking "Next" another windows gets open which lets you give a name to the Project and once you're ready click "Finish".
- OR You can also simply go to File > New > click on Java Project. Which opens up the window shown below.
- Once you click on "Finish", the project with the given name will display on left pane.
Create a Package
Right click on "MyFirstProject" and New > Package. On clicking on Package a window will appear to give name for the Package. Once you're ready click on "Finish".
Once you click on "Finish" button, your package will get created and will display under your project.
Create a Class
To create a class, right click on package or project, New > Class. On clicking Class a window will appear to give name for the Class. You can select a "main" method to include in the Class (shown by a red arrow in the image below) or if you don't select it, then you can write it manually inside your class.
Once you're ready click on "Finish".
Once the Finish is clicked, Class will get created and it will start displaying under the package name "org.app.v1".
Configuring Selenium
- Right click on project "MyFirstProject" > Buid Path > Configure Build Path.
- A window will get open and now go to "Libraries".
- Click on "Add external JARs" to add selenium jar files.
- Once you're done adding the selenium jar files in the libraries, click on "Apply and Close".
You have successfully configured Eclipse with Selenium WebDriver now.
















