We can use WebDriver-Backed Selenium-RC when converting selenium 1.0 to webdriver or use some of the commands of Selenium RC in webdriver.
// You may use any WebDriver implementation. Firefox is used here as an example WebDriver driver = new FirefoxDriver(); // A "base url", used by selenium to resolve relative URLs String baseUrl = "http://seleniummaster.com"; // Create the Selenium implementation Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl); // Perform actions with selenium selenium.open("http://seleniummaster.com"); selenium.type("name=username", "xxxx"); selenium.click("name=login"); // Get the underlying WebDriver implementation back. This will refer to the // same WebDriver instance as the "driver" variable above. WebDriver driverInstance = ((WebDriverBackedSelenium) selenium).getWrappedDriver(); //Finally, close the browser. Call stop on the WebDriverBackedSelenium instance //instead of calling driver.quit(). Otherwise, the JVM will continue running after //the browser has been closed. selenium.stop(); |