We already have Selenium1.0, why Selenium2.0?
Selenium1.0 can't tackle following items.
1. Native keyboard and mouse events.
2. Same origin policy XSS/HTPP(S)
3. Pop-ups, dialogs (Basic authentication, Self signed certificates and File upload/download)
Selenium2.0 has cleaner API, webdriver and webelements object, better abstraction.
Support of mobile devices- Android, iOS (Open web testing)
//Web driver object browser = webdriver.firefox() //Web element object, to refer any object on the browser search_box_google = browser.find_element_name('q')
I have not seen Java Docs for Opera and Safari browsers.
Support for different types of mobile testing
2. Device connected to workstation.
3. Real device on real location on real network
Removing road blocks, hacks and workarounds
Selenium2 = Webdriver + Selenium1.0 (merging two different projects)
Lets understand the reason behind merging these two projects.
As it is a mature product, Selenium APIs has grown over time and it becomes harder to understand how best to use it.
Webdriver had Object Base API when compared with the Selenium which as Directory based approach.
Webdriver JAVA API looks like this.
When these two frameworks are compared side by side, weakness of one framework is addressed by other.
// Create an instance of WebDriver backed by Firefox WebDriver driver = new FirefoxDriver(); // Now go to the Google home page driver.get("http://www.google.com"); // Find the search box, search for something WebElement searchBox = driver.findElement(By.name("q")); searchBox.sendKeys("selenium"); // And now display the title of the page System.out.println("Title: " + driver.getTitle());
Webdriver APIs are used for driving the browsers as per the user requirement, every browser has most natural language "Best Fit" for driving it, so that each developer can develop the driver independently.
But there is a problem, a fix made to one driver don't guarantee that the same fix will resolve the issue in other drivers. Every programmer is good in his own language, Java programmer many not be efficient in writing C++ programs, this create lot of redundant work across the drivers and huge testing activity.
Following are the drivers available in Selenium2.0 currently
AndroidDriver, ChromeDriver, EventFiringWebDriver, FirefoxDriver, HtmlUnitDriver, InternetExplorerDriver, IPhoneDriver, IPhoneSimulatorDriver, RemoteWebDriver
|Name of driver||Available on which OS?||Class to instantiate|
|Internet Explorer Driver||Windows||org.openqa.selenium.ie.InternetExplorerDriver|
Selenium2 five minutes starting guide
Selenium2 webdriver new kid
Enjoy using Selenium 2.0 clean API.