Is it possible to automatically open Google Chrome devtools?
at the terminal, type the following -
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --auto-open-devtools-for-tabs
You can use Robot class for same. It just going to help you to open dev-tools on any browser.
Use this code on the place 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()); }
You can used below given code, it is working fine with FireFox just change the browser
public void open(String url) { driver.get(url); Actions action = new Actions(driver); String pressF12=Keys.chord(Keys.F12,""); driver.findElement(By.id("lst-ib")).sendKeys(pressF12);}