tl;dr A long post about using Selenium 1 sort syntax with Selenium 2/WebDriver.
I have seen automation teams suffering from verbosity of web driver way
of writing code. One automation guy told me once that he does not want
to use Selenium 2 on a brand new project because he finds its syntax
utterly weird. But before discussing "Weirdness"
of Selenium 2 syntax, let us agree on fact that teams migrating from
pure manual testing to automation code find it more weird than ever.
While selenium.type("elementLocator", "testData") looks simple to them.
Using driver.findElement(By.xPath).sendKeys("testData") looks excessive
coding to be able to perform same operation.
Herein I am illustrating the way to wrap Selenium 1 and Selenium 2/WebDriver methods. Don't consider this as the only way of wrapping, I am sure there are better solutions than this.
This is how Selenium1 code (Google again) goes. In the following example there are 5 basic entities -
- SelTestCase class - which sets up test bed for Selenium
- ActionDriver class - which carries out operations on page
- Page element classes - which store element locators
- Page object classes - which represents services offered by page and