Actions Class in Selenium Webdriver

988 views Asked by At

I am trying to perform the Control+A operation using the Actions class in Selenium using the following query:-

driver.get("https://jqueryui.com/datepicker/");

new Actions(driver).keyDown(Keys.CONTROL).sendKeys("a").keyUp(Keys.CONTROL) .build().perform();

However , instead doing Control+A for the contents on the Webpage , it is performing the same operation in the URL bar. Could someone please let me know what is the error here.Moreover the issue what i see is the control stays in the URL bar and it doesnt come down to the Webpage.

1

There are 1 answers

2
NarendraR On

I think there is an issue with pressing keys in selenium 3.0 which is reported here Actions sendKeys UnsupportedCommandException with geckodriver

You can try following alternative way to do that -

driver.findElement(By.xpath("//body")).sendKeys(Keys.chord(Keys.CONTROL, "a"))