Favourite Quote

Every artist was first an amateur. - Ralph Waldo Emerson The more difficulties one has to encounter, within and without, the more significant and the higher in inspiration his life will be. - Horace Bushnell

Thursday, March 1, 2012

Writing our first script in WebDriver

Prior to getting started with writing scripts ensure that you have completed your installations & you have identified which framework you would work with

I have chosen to write the test in JUnit Framework , Where Eclipse is my IDE & Selenium 2.

Here is a basic script for search on an amazon site.

Objects that are dealt are :

1. Drop down list

2. Text box

3. Button

4. Link

Actions performed are :

1. Am selecting a value from drop down list

2. Enetering text in the text box

3. Clicking on the button.

4. Clicking the link that meets my partial text of the url's fetched

import org.junit.Test;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Search {


public void testSearch(){

WebDriver driver = new FirefoxDriver();


WebElement dropDownsearch = driver.findElement(By.id("searchDropdownBox"));

dropDownsearch.sendKeys("Electronics & Photo");


driver.findElement(By.id("twotabsearchtextbox")).sendKeys("Sat Nav & Car Electronics");


driver.findElement(By.partialLinkText("Satellite Navigation System")).click();



automationwithselenium.blogspot.com-Google pagerank and Worth