Reputation: 203
I'm attempting to launch the devtools in a chrome browser on Linux by using the keyboard shortcuts. Because I'm using Ruby and it does not have a chord method, I've tried the following:
driver.action.key_down(:shift)
.key_down(:control)
.send_keys("i")
.key_up(:shift)
.key_up(:control)
.perform
The above code will work in Firefox (as suggested in Key press in (Ctrl+A) Selenium WebDriver), but in chrome, it returns nil but no results occur.
Any advice?
Upvotes: 9
Views: 3668
Reputation: 703
In Selenium I have used :
function key F12.
driver.FindElement(By.XPath("String")).SendKeys(Keys.F12);
Upvotes: 1
Reputation: 17553
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());
}
Upvotes: 0
Reputation: 3387
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.
Upvotes: 0