0

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.

A Prad
  • 1
  • 5
  • Have a look at http://stackoverflow.com/questions/11578768/how-to-press-ctrla-to-select-all-content-in-a-page-by-selenium-webdriver-using – asu Dec 23 '16 at 05:55

1 Answers1

0

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"))
NarendraR
  • 7,577
  • 10
  • 44
  • 82
  • Thanks @Narendra, i think the issue was since the control didnt go to the webpage and stayed in the URL bar , it was not happening. Clicking anywhere in the body of the page and doing the action it worked. – A Prad Dec 25 '16 at 14:12
  • Nice to hear you. If it is helpful, don't forgot to accept the answer. – NarendraR Dec 25 '16 at 17:55