Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

How to send ALT/SHIFT/CONTROL key in Selenium WebDriver?

Category: Selenium WebDriver
public static void main(String[] args) 
{
String baseUrl = “https://www.facebook.com”;
WebDriver driver = new FirefoxDriver();
 
driver.get("baseUrl");
WebElement txtUserName = driver.findElement(By.id(“Email”);
 
Actions builder = new Actions(driver);
Action seriesOfActions = builder
 .moveToElement(txtUerName)
 .click()
 .keyDown(txtUserName, Keys.SHIFT)
 .sendKeys(txtUserName, “hello”)
 .keyUp(txtUserName, Keys.SHIFT)
 .doubleClick(txtUserName);
 .contextClick();
 .build();
seriesOfActions.perform();
}

Leave a Reply

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