Reputation: 35
I am migrating from RC to webdriver. In my existing project I use methods from the Selenium Class like selenium.click() selenium.type() etc.
Do I need to change these to the equivalent webdriver commands, or is there a way i can still use these commands?
I use firefox 12, Eclipse IDE
Upvotes: 2
Views: 3309
Reputation: 801
After creating a WebDriverBackedSelenium instance with a given Driver, one does not have to call start() - as the creation of the Driver already started the session. At the end of the test, stop() should be called instead of the Driver's quit() method.
This is more similar to WebDriver's behaviour - as creating a Driver instance starts a session, yet it has to be terminated explicitly with a call to quit().
Upvotes: 4
Reputation: 25076
There is the WebDriverBackedSelenium
. Essentially this is a bridge between the RC API and WebDriver API. This will do what you are after, there will be some modification to code, but majority will still be the same. It gives you the flexibility of the WebDriver itself, while keeping old code the same.
It is highly recommended to fully convert your solution to use the WebDriver API directly.
The WebDriver API is constantly being updated, worked on and supported.
The RC API and the "RC-WebDriver-Bridge" (WebDriverBackedSelenium) won't be.
Page on WebDriverBackedSelenium
exists here:
Sample usage to create a new instance of Firefox:
var driver = new FirefoxDriver();
var selenium = new WebDriverBackedSelenium(driver, baseUrl);
selenium.open("http://www.google.com");
selenium.type("name=q", "cheese");
selenium.click("name=btnG");
selenium.stop();
Upvotes: 4