Backward compatibility in Webdriver
CONVERT SELENIUM SERVER SCRIPT TO
WEBDRIVER FORMAT
à Add this jar to build path of the project
à Import
import
org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.x86.*;
à In @Before annotation
Selenium selenium
= new defaultSelenium() // in selenium-1
Replace this with
FirefoxDriver f = new FirefoxDriver();
Selenium selenium = new WebDriverBackedSelenium(driver, url)
à Remove Start method, Remove SeleniumTestCase Which
is extended with Class
à Run, It will run successfully
package org.abc.xyz;
import
com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;
import
org.openqa.selenium.WebDriverBackedSelenium;
import
org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.x86.*;
public class Tcase1 {
@Test
public void testIN_100() throws Exception {
DefaultSelenium selenium;
FirefoxDriver f = new
FirefoxDriver();
selenium
= new WebDriverBackedSelenium(f, "http://mail.in.com");
selenium.open("/");
selenium.type("id=f_id", "tnitin");
selenium.type("id=f_pwd", "nitin150784");
selenium.click("//input[@value=''
and @value='' and @type='submit']");
selenium.waitForPageToLoad("30000");
selenium.click("link=Sign
out");
selenium.waitForPageToLoad("30000");
}
}
Subscribe to:
Post Comments
(
Atom
)
good article shared oracle training in chennai
ReplyDelete