Selenium – First script to open Google and search “Hello World”


Follow 6 steps to configure Selenium with Eclipse

1. Install Java:- Download Java JDK as per your OS from below link:-

Note:- JDK version comes bundled with Java Runtime Environment (JRE), so you do not need to download and install the JRE separately. 

2. Install Eclipse:- Download Eclipse from below link:-

Along with Eclipse, Intellij & Jboss are also other good options. 

3. Install Selenium WebDriver:- Download Selenium WebDriver Language Binding from below link:-

4. Configure Eclipse IDE with WebDriver

I.    Create a new project i.e. File > New > Java Project

•    Project Name

•    Check Location to save project

•    Click on Finish button

II. Create a package “newpackage” and a class “clsFirstTest”.

III. Now add Selenium WebDriver JAR’s files by doing Right Click on Project > Properties > Java Build Path > Add External JARs > Select all JAR’s which downloaded at step # 3. 

5. Download Chrome Driver:- Check the version of your browser and download same version of driver and add it in your one folder e.g. Drivers

6. Add the Code in class to launch the browser to launch and enter “Hello World” .

package SeleniumTraining.Se2MavenProject;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

public class HelloWorldGoogle
public static void main(String[] args) {
//Set Chrome Driver Path
System.setProperty(“”, “Driver\chromedriver.exe”);
// Initialize browser
WebDriver driver=new ChromeDriver();
// Open Google
//Enter Hello World
driver.findElement(By.xpath(“//input[@name=’q’]”)).sendKeys(“Hello World”);
//Print message


Please enter your comment!
Please enter your name here