Selenium Web Driver
Web Driver is just a JAR file which contains collection of interface and class.
Web Driver is a web based automation testing tool which uses core Java API to drive the test on the browser. Technically Web Driver is an interface , all the browsers driver classes are implemented as Web Driver interface and also many other interfaces.
It is a new version of Selenium which removes many drawbacks and issues in Selenium RC. Web Driver as native supports all the browsers and all the APIs of Web Driver are purely object oriented.
Web Driver supports multiple browsers. For Web Driver it doesn't matter whether their is already opened browser, it launches a new browser for each execution.
Whenever Web Driver launches all the add-ons are automatically get disabled.
Class Name in Web Driver:
Web Driver Required Softwares:
- WebDriver client library
- Supported browser:- IE more than 3.5 version and Mozilla should be more than 6.0 version.
- Editor:- Eclipse
WebDriver code syntax:
- Create object to browser and launch empty browser.
Example: webDriver driver = new FireFoxDriver();
- Navigate to application URL.
Example: driver.get("www.google.com");
- Find the element in UI.
Example: Wb = driver.findelement(By.locatorname);
If element present in UI, find element method and return web element object, if element not present in UI throws "No such element exception".
Following Locator's available in WebDriver:-
- ID()
- Name()
- Xpath()
- CSS locator()
- Link text()
- Partial link text()
- Class name()
- Tag name()
All the above locators are static methods which are implemented under the 'By' class.
- Perform an operation with Web element.
Example: Wb.sendkeys("admin");
How to include Web Driver APIs to Eclipse?
- Open Eclipse with workspace.
- Create a Java project.
- Create package.
- Select source right click --> Build Path --> Click on configure build path --> will get a property window --> click on add external JARs --> import all the Web Driver JAR files from the local drive --> import all the JAR files out of library and then import all the JAR files inside the JAR file.
0 Comment(s)