Tutorials Hut

  • Selenium WebDriver

       Selenium Introduction
       Benefits of Selenium
       Four components of Selenium
       Difference b/w Selenium IDE, RC & WebDriver
       Selenium WebDriver Architecture
       Background when user execute selenium code
       Download and Install Java
       Download and Install Eclipse
       Download Selenium WebDriver
       Selenium WebDriver Locators
       Selenium - Launch Browser
       Selenium WebDriver Waits
       Selenium- Implicit wait
       Selenium- Explicit wait
       Selenium- Fluent wait
       Selenium- Commonly used commands
       Selenium- findElement & findElements
       Selenium- Selenium-Handling check Box
       Selenium- Handling Radio button
       Selenium- Handling drop down
       Selenium- Take Screenshot
       Selenium- Handle Web Alerts
       Selenium- Multiple Windows Handling
       Selenium- Handle iframes
       Selenium- Upload a file
       Selenium- Download a file
       Selenium- Actions Class Utilities
       Selenium- Mouse Actions
       Selenium- Keyboards Events
       Selenium- Handle mouse hover Actions
       Selenium- Drag and Drop
       Selenium- Scroll a WebPage
       Selenium- Context Click / Right Click
       Selenium- Double Click
       Selenium- Desired Capabilities
       Selenium- Assertions
       Selenium- Exceptions and Exception Handling
       Selenium- Difference b/w driver.close() & driver.quit()
       Selenium- difference b/w driver.get() & driver.navigate()
       Selenium- JavascriptExecutor
       Selenium- Read excel file using Fillo API
       Selenium- Database Testing using Selenium
       Selenium- Read & write excel file using Apache POI
       Selenium- Read and Write csv file in Selenium
       Selenium- Dynamic Web Table Handling
       Selenium- Maven Integration with Selenium
       Selenium- Set up Logging using Log4j
       Selenium-Implement Extent Report



  • Actions Class Utilities :Mouse Actions and keyboard related events in Selenium

    This article will present you with a complete idea about how to handle events using mouse and keyboard using selenium webDriver , also we learn about what is Actions class in selenium and its usage.

    Action Class Utilities- Mouse and Keyboard Events

    Selenium provides API to Automate the Keyboard Events, Mouse events and drag and drop feature. We can achieve this by using both Action (an Interface) & Actions class.

    We will be covering below topics in this article

    What is Actions Class in Selenium?

      • Actions class in Selenium provides multiple methods to perform a single action or series of actions in the browser.
      • Any interaction completed by mouse and keyboard can be automated by using the Actions class in Selenium. 
      • This API is the part of org.openqa.selenium.interactions package in Selenium library.
      • Actions class contains a collection of actions that can be performed in a web application.

    Using Action class we can handle keyboard and mouse events. i.e., 

      • Keyboard events
      • Mouse actions

    What is the Action interface in Selenium?

      • Action is an interface which represents a single user-interaction action.
      • This API is the part of org.openqa.selenium.interactions package in Selenium library.

    It contains one of the most widely used method perform() after creating a series of actions and storing in Action

    Actions Class - Selenium

    Mouse Actions in Selenium

    The various mouse actions that are provided by the Actions class are-

      • click() – clicks at the current location
      • clickAndHold()-Clicks (without releasing) at the current mouse location
      • clickAndHold(WebElement target)– Clicks (without releasing) in the middle of the given element.
      • Release() – Releases the depressed left mouse button at the current mouse location
      • moveToElement(WebElement target) – moves to the target element
      • doubleClick() – performs a Double click at the current mouse location
      • contextClick() – performs a Right click at the current mouse location
      • dragAndDrop(WebElement source, WebElement target) – drags an element from the source location and drops in target location

    Keyboard Events in Selenium

    The various keyboard actions that are provided by the Actions class are-

      • KeyUp()– The keyUp is used to simulate key-up (or) key-release action of a modifier key(CONTROL, SHIFT, ALT) , below are two overloaded methods are used for this
      • keyUp(CharSequence key) – This method performs a key release on the currently focussed Web Element.
      • keyUp(WebElement element, CharSequence key):performs a key release after focusing on the target element
      • KeyDown()The keyDown is used to simulate action of pressing a modifier key(CONTROL, SHIFT, ALT),Below are two overloaded methods are used for this
      • keyDown(CharSequence key) -This method performs a key down on the currently focussed Web Element.
      • keyDown(WebElement target, CharSequence key) – performs a key press after focusing on the target element.
      • SendKeys()-This method sends a series of keystrokes to a given web element. This method has two overloaded formats:
      • sendKeys(CharSequence… KeysToSend) -This method sends a sequence of keys to a currently focused web element,
      • sendKeys(WebElement element, CharSequence… KeysToSend) :This method sends a sequence of characters/keys to a specific web element, 

    Apart from the above methods, there are many other methods which can be used based on our requirements.

    How to implement Actions Class?

    Below are the steps for implementing Actions class in Selenium automation test cases ,

    Step 1:Import the Actions and Action classes.

    org.openqa.selenium.interactions.Actions
    org.openqa.selenium.interactions.Action

    Step 2: To use the methods provided by the Actions class, we need to create an object of Action class and pass the WebDriver as an argument.

    // instantiate the WebDriver

    WebDriver driver = new ChromeDriver();

    // create an object of the Actions class

    Actions act = new Actions(driver);

    Scenario 1- Focus and click on the particular element

    //To focus on element using WebDriver:

    action.moveToElement(element).perform(); 

    //for clicking on any element

    action.moveToElement(element).click().perform();

    —> perform() method is used here to execute the action.

    Scenario 2- Right click on a particular element

      //contextClick() method to do right click on the element

        action.contextClick(element).build().perform();



  • Selenium WebDriver Tutorials

       Selenium Introduction
       Benefits of Selenium
       Four components of Selenium
       Difference b/w Selenium IDE, RC & WebDriver
       Selenium WebDriver Architecture
       Background when user execute selenium code
       Download and Install Java
       Download and Install Eclipse
       Download Selenium WebDriver
       Selenium WebDriver Locators
       Selenium - Launch Browser
       Selenium WebDriver Waits
       Selenium- Implicit wait
       Selenium- Explicit wait
       Selenium- Fluent wait
       Selenium- Commonly used commands
       Selenium- findElement & findElements
       Selenium- Selenium-Handling check Box
       Selenium- Handling Radio button
       Selenium- Handling drop down
       Selenium- Take Screenshot
       Selenium- Handle Web Alerts
       Selenium- Multiple Windows Handling
       Selenium- Handle iframes
       Selenium- Upload a file
       Selenium- Download a file
       Selenium- Actions Class Utilities
       Selenium- Mouse Actions
       Selenium- Keyboards Events
       Selenium- Handle mouse hover Actions
       Selenium- Drag and Drop
       Selenium- Scroll a WebPage
       Selenium- Context Click / Right Click
       Selenium- Double Click
       Selenium- Desired Capabilities
       Selenium- Assertions
       Selenium- Exceptions and Exception Handling
       Selenium- Difference b/w driver.close() & driver.quit()
       Selenium- difference b/w driver.get() & driver.navigate()
       Selenium- JavascriptExecutor
       Selenium- Read excel file using Fillo API
       Selenium- Database Testing using Selenium
       Selenium- Read & write excel file using Apache POI
       Selenium- Read and Write csv file in Selenium
       Selenium- Dynamic Web Table Handling
       Selenium- Maven Integration with Selenium
       Selenium- Set up Logging using Log4j
       Selenium-Implement Extent Report

















  • Leave a Reply

    Your email address will not be published. Required fields are marked *