I need to press Ctrl+A keys using Selenium WebDriver. Is there any way to do it?
I checked the Selenium libraries and found that Selenium allow
Simplest answer in C# (if you are C# inclined).
Actions action = new Actions();
action.KeyDown(OpenQA.Selenium.Keys.Control).SendKeys("a").KeyUp(OpenQA.Selenium.Keys.Control).perform();
This answer is almost given above by Hari Reddy but I have fixed the case which he'd got wrong on some keywords, added the KeyUp or you get in a mess leaving the control key down, I've also added the clarification on OpenQA.Selenium.Keys because you may also be using Windows.Forms on the same class as I was an require this clarity. Lastly, I type "a" because I found that to be the simplest way and I can see no suggestion from the OP that they don't want the simplest answer.
Many thanks to Hari Reddy though as I was a novice in Actions class usage and I was writing many different commands, chaining them together the way he showed is quicker :-)