Sunday, 11 August 2013

How to Configure Selenium Webdriver with Ruby

Configure Selenium Webdriver With Ruby

Step 1 :  Download Ruby from

Step 2: Install Ruby

Step 3: Verify Ruby Version

Open Start->Interactive Ruby

Write command RUBY_VERSION

Step 4: Download Selenium- Webdriver gem from

Step 5 :Install Selenium Webdriver Gem :

1.Open Start->cmd
2. Navigate to folder where gem is downloaded using cd
(Example cd c:\Users\Downloads)
3. Write command   gem install selenium-Webdriver

Step 5: Execute Webdriver script in Ruby

There are different ways to execute script

1. Write ruby code in notepad and save it with .rb extension and Run from Command Line


-Paste following code in notepad and save as “Test.rb”

require "selenium-webdriver"

driver = Selenium::WebDriver.for :firefox ""

element = driver.find_element(:id, "sb_form_q")
element.send_keys "Test Automation!"
driver.find_element(:id, "sb_form_go").click

puts "Test Completed"

puts driver.title


-Open Start->cmd

-Navigate to folder where .ruby file is installed

-Write ruby Test.rb

2.  Open Start->Interactive Ruby

Paste following code in ‘interactive Ruby’ Window

Note: for Ruby Scripting many tools are available like RDE, Ruby IDE etc.
Also Eclipse can be used for Ruby Scripting by adding some plug-ins.

Saturday, 10 August 2013

How To Configure Selenium Webdriver With Java(Eclipse)

Configure Selenium Webdriver  With Java(Eclipse)

Step1:Download Java IDE  from

Step 2: Download JDK according to System Type (32-bit or 64-bit) from

Step 3: Download Selenium Webdriver for JAVA from

Step 4 : Install JDK

Step 5 : Set Environment Variables (Windows 7 )

1.Right Click On Computer
2.Click on Properties 
3.Click On ‘Advance Settings’
4.On  ‘System Properties ‘  Click On tab ‘Advance’
5.Click on ‘Environment Variables ‘

 6.Copy  following path where JDK  is installed .
C:\Program Files\Java\jdk1.6.0\bin

7.On Environment Variable Window  Click ‘New’ Under System Variable  and Set  Path: C:\Program Files\Java\jdk1.6.0\bin
-If Path Variable already Exist Then Edit it .

Copy  following Path Where JDK is installed :

On Environment Variable Window Click ‘New’ under  User Variables and Set  CLASSPATH :

Enviornment is set up now  start JAVA IDE

Step 6 : Extract Downloaded JAVA IDE  and Click on ‘Eclipse’
Set Workspace and Check Option “Use this as Default browser”

Step 7: Open File -> New-> Other

Click On ‘Next’
Click on ‘Finish’

Step 8 : Right Click on ‘Src’ and  Select New-> Package 

Give Name as Com.Project1 and Click on ‘Finish’

Step 10: Configure Build Path:
-Right Click on Src, Select Build Path->Configure Build Path

-Click on Tab ‘Library’ and Click on ‘Add External Jars’
Select  Selenium  Webdriver  Jar files .

Step 11 : Now Start Coding in Main() J
Paste below  code in Class
package com.project1;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.*;

public class Class1 {
        public static void main(String[] args) {
//Initiate Driver   
 WebDriver driver = new FirefoxDriver();
//Get Element By Id
driver.findElement("sb_form_q")).sendKeys("Test Automation");
System.out.println("Test Completed");


Step 12 : Run Test

1.Right Click on Class1
2.Select Run As ->Run Java Application

To Run  Selenium script in IE or Chrome Following changes may Require

       1. Download Driver from according to
 System Type (32 –bit or 64-bit)

2. Add  import* and import*;
For iE and Chrome respectively
3. Add following statements to give path of respective drivers .
For ie :
System.setProperty("", "C:\\Users\\IE Driver\\IEDriverServer_Win32_2.33.0\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();

For Chrome :
System.setProperty("", "C:\\Users\\Chrome Driver\\chromedriver_win32_2.1\\chromedriver.exe");
WebDriver driver = new ChromeDriver();

Saturday, 3 August 2013

How to Configure Selenium Webdriver with C#

How To Configure  SeleniumWebdriver  with C# (Visual Studio )

Getting Started With Selenium C#

Step 1: Download Selenium Webdriver from

Step 2  : Start Visual Studio and  create a New Project
              Select New Project->Visual  C#->Windows->Console Application

Step 3: Right Click on Console Application under Solution Explorer and Click on 'Add Reference '

Step 4: Click on ‘Browse’ on ‘add Reference’ Window and Navigate to Selenium Webdriver Location and Select folder net40

Step 5: Select all files and Click on ‘Add’

 Step 6: Click ‘OK’ on Reference Manager Window

Step 7: Start Coding in C# J
-Add Selenium namespaces with ‘using’ directive.
-Paste Below code in  program.cs
(Script to search word 'Test Automation' on

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium;

namespace ConsoleApplication1
    class Program
        static void Main(string[] args)
             //Initiate Driver
            IWebDriver driver = new FirefoxDriver();
            //Get Element by Id
            driver.FindElement(By.Id("sb_form_q")).SendKeys("Test Automation");
            Console.WriteLine("Test Case Completed");
Step 8: Run Selenium Script
-Press F5 or ‘Start ‘

After Running Script

 Run  Selenium script in IE or Chrome Following changes may Require
       1. Download Driver from according to
 System Type (32 –bit or 64-bit)

2.       Add namespaces  using OpenQA.Selenium.IE; OR using OpenQA.Selenium.Chrome;
3.       Give Path of respective driver (IE or Chrome) as follows.
-          For  IE
   IWebDriver driver = new InternetExplorerDriver(@"C:\Users\IE Driver\IEDriverServer_Win32_2.33.0");

-          For  Chrome
IWebDriver driver = new ChromeDriver(@"C:\Users\Chrome Driver\chromedriver_win32_2.1");