Quick Reference Study Notes for Selenium Webdriver Features

What is Selenium WebDriver?
Selenium WebDriver is an open source tool which is used for automating only the Web based applications (Web applications are tested using any web browser)
Selenium WebDriver supports a diverse range of web browsers such as Firefox, Chrome, Internet Explorer, Opera and many more. It also supports some of the non-conventional or rare browsers like HTMLUnit.

 


Features of Selenium WebDriver:

  1. It provides the improved reliability between browsers. 

  2. It allows you to simulate the clicking of browser front and back button.

  3. WebDriver can support the headless HtmlUnit browser

  1. WebDriver is faster than Selenium RC since it speaks directly to the browser uses the browser's own engine to control it.

  1. Selenium Webdriver is having the Auto Scroll Up and Down feature into the application while executing the scripts.

  2. Selenium Webdriver supports the different languages like Java, C#, PHP, Ruby, Python.

  3. WebDriver can support the headless HtmlUnit browser

  4. We can effectively take the information from the application by using the commands get text and get attribute to validate the application.

  5. WebDriver also allows testers to deal with complex types of web elements such as checkboxes, dropdowns and alerts through dynamic finders.


 

 

How to launch the browser in selenium webdriver?

For instance, to launch a browser in WebDriver following commands are used:

Firefox browser
WebDriver driver = new FirefoxDriver();

Chrome browser
WebDriver driver = new ChromeDriver();

WebDriver driver = new InternetExplorerDriver();
Internet Explorer browser

 

Here, "WebDriver" is an interface, and we are creating a reference variable "driver" of type WebDriver, instantiated using "FireFoxDriver", ”ChromeDriver”,  “InternetExplorerDriver”class respectively


Browser and interactive Commands

 

Commands

Description

driver.get(“URL”)

It is to open the URL of the application.

driver.quit

It is to close the Browser.

driver.close

It is to close the child or Pop up window.

sendkeys

It is to enter some value in the text box.

clear

It is to clear the data from the text box.

driver.click

By using this command, we can click on a Button, Radio Button, Checkbox, Image, link etc.

new select

It is to select the value from a drop-down and a list box.

driver.navigate().refresh()

Reload a web page

driver.switchTo().window("windowName")  


 

Moving between Windows

 

Webdriver Commands for locating Elements

 

Commands

Description

By.id

finds elements based on the value of the "id" attribute

By.className

locates elements by the value of their "class" attribute

By.cssSelector

finds elements based on the driver's underlying CSS Selector engine

By.name

locates elements by the value of the "name" attribute

By.linkText

finds a link element by the exact text it displays

By.partialLinkText

Locates elements that contain the given link text

By.tagName

locates elements by their tag name

By.xpath

locates elements via XPath


*NOTE : "This study material is collected from multiple sources to make a quick refresh course available to students."
 

This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Cookie Policy. More info. I Agree