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



  • How to Perform Context Click / Right Click using Actions in Selenium?

    This article will present you with a complete idea about how to perform right click and do any operations using Actions Class in selenium web driver.

    During testing of an application ,we may need to do right click /context click then select any options .This can be achieved in Selenium with the help of Actions Class.

    Selenium- Right Click- Context Click

    Below are the steps mentioned for performing right click on any webElement/button 

    Steps:

    1)Instantiate an Actions class:  

    Actions actions = new Actions(driver);

    2) identify the webElement/Button where we have to perform right click 

     WebElement webElement = driver.findElement(Any By strategy & locator); 

    3) Right click on the identified element/button and perform the click

    actions.contextClick(webElement).perform(); 

    We will understand right click actions with the help of below scenario

    1. Navigate to URL https://tutorialshut.com/demo-website-for-selenium-automation-practice/
    2.  Find the ‘Submit’ button and do right click on the element
    3. Go to the options ‘copy’ and click
    4. Close the browser to end the program
    Code Implementation
    package com.test;
    
    import java.awt.AWTException;
    
    import java.awt.Robot;
    
    import java.awt.event.KeyEvent;
    
    import java.io.IOException;
    
    import org.openqa.selenium.By;
    
    import org.openqa.selenium.WebDriver;
    
    import org.openqa.selenium.WebElement;
    
    import org.openqa.selenium.chrome.ChromeDriver;
    
    import org.openqa.selenium.interactions.Actions;
    
    import io.github.bonigarcia.wdm.WebDriverManager;
    
    public class ContextClick {
    
    public static WebDriver driver;
    
    public static void main(String[] args) throws IOException, InterruptedException, AWTException {
    
    // Create a new instance of the Chrome driver
    
    System.setProperty("webdriver.chrome.driver","D:\\Drivers\\chromedriver.exe");
    
    
    driver = new ChromeDriver();
    
    // Launch the URL
    
    driver.get("https://tutorialshut.com/demo-website-for-selenium-automation-practice/");
    
    driver.manage().window().maximize();
    
    Thread.sleep(3000);
    
    Actions action = new Actions(driver);
    
    // Identify submit button
    
    WebElement submitButton = driver.findElement(By.id("idOfButton"));
    
    // contextClick() method to do right click on the element
    
    action.contextClick(submitButton).build().perform();
    
    Thread.sleep(2000);
    
    // Click on copy button
    
    Robot robot = new Robot();
    
    robot.keyPress(KeyEvent.VK_DOWN);
    
    robot.keyRelease(KeyEvent.VK_DOWN);
    
    robot.keyPress(KeyEvent.VK_ENTER);
    
    robot.keyRelease(KeyEvent.VK_ENTER);
    
    System.out.println("copy button is clicked");
    
    // close the driver
    
    driver.close();
    
    }
    
    }
    



  • 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 *