What is WebDriver?

WebDriver it’s an open source tool ,and the most common tool for web function testing.

WebDriver is next version of Selenium-RC(remote control) , it’s also called Selenium2. 
“Selenium 1.0 + WebDriver = Selenium 2.0”.
write your code in any language you like (Java, Javascript, Ruby, PHP, Python, Perl and C#)
the main feature of WebDriver is to improve the connection and the facilities with the browser. 
unlike Selenium RC that tries to wrap the web pages and interact with them via JS layer, WebDriver “talk’s” directly with the browser.

WebDriver project focus on :

  • simulate action on the browser as regular user.
  • cross browsers(also mobile) testing. 
  • OO API design and simpler API 
  • backward compatibility  – almost fully support in the old API and support in SeleniumGrid
  • overcomes the limitation of Selenium Rc :Single Host origin policy , file upload or download, pop-ups and dialogs barrier.

Web Locators

WebDriver is using the DOM of the web pages to get/set text,click on elements, drag and drop ,etc… 
each element can be located by:
Locator Example 
Element id attribute By.id(“elementId”)
Element name attribute By.name(“elementName”)
Xpath  By.xpath(“//input[@id=’ElementId’]”)
Class name By.className(“table-element”)
CSS Selector By.cssSelector(“span.mce.btn”)
Link Text By.linkText(“Click Me!”)
By.partialLinkText(“ck M”)
Tag Name By.tagName(“input”)

patterns and extensions

  • Page Object design pattern –useful and simple design pattern that helps you design your code into pages. Add abstraction of the UI  into Code. each page expose public interface and on actions that result in navigation that interface returns another page that implemented in the same pattern. 
  • LoadableComponent – extend the Page Object pattern and make the load of the components less painful. 
  • BotStyleTests  – alternative to the Page Object pattern.Bot Style action-oriented abstraction layer that helps  the automation developer reuse  and encapsulate Selenium actions. 
  • fluent-selenium – nice project that aims to provide for more readable code.this project also provide:Built-in Assertions,Ajax handling,auto retry ,find element by attribute(not just id or name or class)
  • Page Factory -the ability to init all the page( of Page Object pattern) elements via reflection.

How Top-Q Contributes and improve WebDriver project

Top-Q develop the next packages :
  • jsystem-so-webdriver – Maven Jsystem driver that help you init Webdriver for external xml file (SUT file). the main feature are:
  1. plug-and-play
  2. init the browsers in a simple way from external file (no need to download additional files e.g. IeDriverServer.exe that required in case of IE).
  3. Save the browser state between tests
  4. close the browser after the execution
  5. built-in support in  Page Object pattern
  6. automatic logging (on each action) without changing your code
  7. automatic screenshot(on each action)without changing your code