How to use WebDriver Backed Selenium

  • (5.0)
  • | 2774 Ratings

WebDriver Backed Selenium

The Java version of Webdriver provides an implementation of the Selenium-RC API. This means that you can use the underlying WebDriver technology using the Selenium-RC API. This is primarily provided for backwards compatiblity. It allows those who have existing test suites using the Selenium-RC API to use WebDriver under the covers. It’s provided to help ease of the migration path to Selenium-Web driver.
Sample Backed web driver script looks like this:

package webone;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.thoughtworks.selenium.SeleneseTestCase;

import com.thoughtworks.selenium.Selenium;
public class BackedSelenium extends SeleneseTestCase {
//web driver ??here we are declaring the browser
WebDriver driver = new FirefoxDriver();
public void setUp() throws Exception {
String baseUrl = "";
selenium = new WebDriverBackedSelenium(driver, baseUrl);

public void testBackedSelenium() throws Exception {
//This is using selenium"/");"id=gbi5");"id=gmlas");
selenium.type("name=as_q", "test");
//Here we are using Webdriver


public void tearDown() throws Exception {

By using the above format, you can use both the Selenium API and Web driver API…

Interested in mastering Selenium Training? Enroll now for FREE demo on Selenium Training.

Run WebDriver Scripts in Chrome

We run the Selenium Webdriver programs in Google Chrome web browser to perform automation testing.
Below theory explains you how to run your webdriver script in google chrome..
Firefox Browser:
driver=new FirefoxDriver();---it will work and will launch your firefox browser,
Google Chrome:
driver= new Chromedriver() --- it will throw an error.
FAILED CONFIGURATION: @BeforeClass beforeClass
The path to the driver executable must be set by the system property; for more information.
To overcome this, we need to download the chrome driver.exe and we have to specify the path of a chrome driver in the script
Download path: take the latest exe file.

chrome driver

Checkout Selenium Interview Questions

Save the chrome driver in a folder and you need to specify the path of a driver in your web driver script.
Below is the Sample code:

package testng;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class ChromedriverTest {
public WebDriver driver;

public void beforeClass() {
// Create chrome driver instance...
System.setProperty("", "C:xxxJarchromedriver.exe");

driver=new ChromeDriver();

public void testChromedriverTest() throws Exception {

public void afterClass() {


Use the above code for your script which will run in Google chrome.

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

Subscribe For Free Demo

Free Demo for Corporate & Online Trainings.

About The 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 most of her time researching on technology, and startups. Connect with her via LinkedIn and Twitter . Protection Status