Home  >  Blog  >   Selenium

Introduction to Selenium 2.0 Webdriver-SELENIUM

Rating: 4
  1. Share:
Selenium Articles

Selenium WebDriver

Selenium WebDriver is also known as selenium 2.0. Web driver is a tool for automating web applications. The main aim of web driver is to provide a user friendly API.

Advantages over Selenium RC(1.0)

1. Selenium 2.0 has many new exciting features and improvements over Selenium 1.
2. Selenium 2.0 has more API than selenium 1.0
3. The new Feature is integration of the Web driver API.
4. By this web driver API we can overcome issues in Selenium 1.0
5. The goal is to develop an object-oriented API.
6. It is faster than Selenium RC / 1.0
7. There are more ways to identify objects ()
8. No need of starting a server.
9. Page synchronization is handled automatically.

For an in-depth understanding and practical experience, Explore Online Selenium Training.

How to setup Web driver using eclipse and Junit / TestNG

The set up of Web driver is quite similar to Selenium RC.
Jdk 1.5 or above
Eclipse 3.5 or above
Jar files:
All files in selenium-java-2.X.0 folder and selenium-server-standalone-2.x.0 server file.
1. Open Eclipse.
2. File–new—Java project.
3. Enter Project Name Web Driver and click Finish.
4. A project is created.
5. Right click on JRE sys library and click buildpath—configure build path.
6. Add all external jar files (selenium-java-2.X.0 and selenium-server-standalone-2.x.0).
7. Done you are ready to write scripts using selenium webdriver.

Checkout Selenium Tutorial

More Ways to identify Elements

By ID:
By Name:
By Link Text:
driver.findElement(By.linklinkText(“Sign In and Register”));
By Partial Link Text:
driver.findElement(By.partialLinkText(“Sign In”));
By Class Name:
By Tag Name:

MindMajix YouTube Channel

Checkout Selenium Interview Questions

Sample scripts

Here is the sample web driver script created using Junit.

package practice; //package name
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;
public class First {
private WebDriver driver; //Declaring variable

public void setUp() throws Exception {
driver = new FirefoxDriver();//Creating firefox driver
TimeUnit.SECONDS);//implicit time out, it is like wait for page to load in selenium rc

public void testFirst() throws Exception {
//open google page in maximized mode
//click options button
//click advanced search link
//type search word in text box
//select value from Dropdown
new Select(driver.findElement(By.name("tbs"))).selectByVisibleText("show only
basic results");
//Click advanced search button

public void tearDown() throws Exception {
//Quit the driver

Explore Selenium Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!


Join our newsletter

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
Selenium Training May 21 to Jun 05View Details
Selenium Training May 25 to Jun 09View Details
Selenium Training May 28 to Jun 12View Details
Selenium Training Jun 01 to Jun 16View Details
Last updated: 03 Apr 2023
About Author


Madhuri is a Senior Content Creator at MindMajix. She has written about a range of different topics on various technologies, which include, Splunk, Tensorflow, Selenium, and CEH. She spends most of her time researching on technology, and startups. Connect with her via LinkedIn and Twitter .

read more
Recommended Courses

1 / 15