Created
September 28, 2020 13:52
-
-
Save muditlambda/7c9a648f2396f6fcff2f21a0fe2bb54a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Actions; | |
public class keysDemo { | |
public static void main(String[] args) { | |
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Shalini\\Downloads\\Driver\\chromedriver.exe"); | |
WebDriver driver = new ChromeDriver(); | |
driver.get("https://www.google.com/"); | |
driver.manage().window().maximize(); | |
WebElement element = driver.findElement(By.xpath("//*[@id=\"tsf\"]/div[2]/div[1]/div[1]/div/div[2]/input")); | |
Actions action = new Actions(driver); | |
//holds the SHIFT key and converts the text to uppercase | |
action.keyDown(element,Keys.SHIFT).sendKeys("lambdatest").build().perform(); | |
driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment