Tutorial on Selenium RC               

Configuration Selenium RC with eclipse to run Junit Tests :

    1) Download eclipse. click here to download the software

    2) Open eclipse -> Workspace Launcher window will open

    3) Create a workspace by giving meaningful name

    3) Click on Workbench

    4) Create a project of type java

    5) Create a package under src folder of the package

    6) Add Junit to the build path

    7) Add selenium rc java client driver to the build path

    8) Now drag and drop your test script (.which is exported from Selenium IDE) to the package created.

Command used for running the Selenium RC Server :

    The procedure followed to run the Selenium RC Server is:

    1. Open the command prompt.

    2. Change the folder path to Selenium RC Server

    3. Command "java -jar selenium-server.jar"

java -jar selenium-server-standalone-2.21.0.jar

 

Sample Program on Selenium RC:

  import com.thoughtworks.selenium.*;
  import org.junit.After;
  import org.junit.Before;
  import org.junit.Test;

public class Google {

  @Before
  public void setUp() throws Exception {
  selenium = new DefaultSelenium("localhost", 4444, "*chrome", "https://google.com");
  selenium.start();
  }
   @Test
  public void search() {
  selenium.open("/");
  selenium.type("id=gbqfq", "selenium");
  selenium.click("id=gbqfb");  
  }
 
  @After
  public void tearDown() throws Exception {
  selenium.stop();
  }

}

 

 

Search site

© 2011 All rights reserved.