Showing posts with label Selenium RC. Show all posts
Showing posts with label Selenium RC. Show all posts

Wednesday, March 19, 2014

Configure with eclipse-Selenium Webdriver and RC

New work-space:


New workbench:


Creating new project:


By clicking java project and give the project name>click next:


Click finish




After clicking finish, it looks as like this…


Next: to create folder within project for importing jar files of Selenium, TestNG


Give the Folder name and click finish


Given folder is present under project:


Download selenium 



Import jars files as copy and paste into the folder
Or
Go to choose folder>right click>build path>configure build path


Click libraries



Click>libraries tab>add external jars and browse the selenium download and click open


Now click>OK
Here: selenium-server-standalone-version is added


Configure build path


Click>OK




Creating package:
File>new>package


Creating class:



Click finish





Adding sample of Selenium RC commands


Here click import Firefox driver


Run as java application:


Before save it else it ask as like this


Wednesday, February 26, 2014

Selenium RC - Sample Code

Work with Selenium RC in eclipse:

//package package_name
package webdriver;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.firefox.FirefoxDriver;

import com.thoughtworks.selenium.Selenium;

//class class_name
public class webdriver_exercise {
public static void main(String[] args) throws Throwable {
// TODO Auto-generated method stub
// set the execution file and its path
System.setProperty("webdriver.firefox.bin",
"C:\\Program Files (x86)\\browser\\Mozilla Firefox 19.0\\firefox.exe");
// connecting to Firefox driver
WebDriver driver = new FirefoxDriver();
// for both WebDriver and RC
Selenium selenium = new WebDriverBackedSelenium(driver,
"http://www.bing.com/");
// open the browser
selenium.open("http://bing.com/");
selenium.waitForPageToLoad("100");
// type the text in search box
selenium.type("name=q", "selenium with rc example");
// click the search button
selenium.click("id=sb_form_go");
// close the browser
selenium.close();
}
}