Sending keyboard shortcuts to chrome with Selenium and Ruby Sending keyboard shortcuts to chrome with Selenium and Ruby google-chrome google-chrome

Sending keyboard shortcuts to chrome with Selenium and Ruby


In Selenium I have used :

function key F12.

driver.FindElement(By.XPath("String")).SendKeys(Keys.F12);


I think you're just using a wrong keys combination. According to this: https://support.google.com/chrome/answer/171571?hl=en&ref_topic=25799, the shortcut to open Developer Tools is Ctrl-Shift-J on Linux and Windows and Cmd-Opt-I on Mac.


You can use robot class of java, if you want to open dev-tools.

    try{        Robot robot=new Robot();        robot.keyPress(KeyEvent.VK_F12);        robot.keyRelease(KeyEvent.VK_F12);      }    catch(Exception ex){        System.out.println(ex.getMessage());    }