Selenium Java to perform series of multiple actions using Action and Actions classes
Codeaft.java
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;

class Codeaft
{
    public static void main(String[] args)
    {   
        System.setProperty("webdriver.chrome.driver", "/home/codeaft/drivers/chromedriver");
        WebDriver driver = new ChromeDriver();
        driver.manage().window().maximize();
        driver.navigate().to("https://codeaft.github.io/testapp/");
        WebElement un = driver.findElement(By.name("username"));
        Actions builder = new Actions(driver);
        Action multipleActions = builder.moveToElement(un).click()
        .keyDown(un, Keys.SHIFT).sendKeys(un, "codeaft").doubleClick().build();
        multipleActions.perform();
    }
}
Comments and Reactions