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();
}
}
//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();
}
}
No comments:
Post a Comment