0

I'm trying to open console when in a chrome/firefox webpage, using this line:

webDriverEx.getWebDriver().findElement(By.xpath("/html/body")).sendKeys(Keys.F12);

it works on IE. tried also:

Actions action = new Actions(webDriverEx);
action.sendKeys(Keys.F12).perform();

but no affect. console won't open. why won't it open?

Guy
  • 46,488
  • 10
  • 44
  • 88
D.Guy
  • 31
  • 1
  • 1
  • 2
  • chrome driver interact with browser via console interface, it will not allow to open the console. could you tell me, why do you want to open the console ? – Murthi Jul 12 '17 at 12:31

1 Answers1

0

Whenever a browser is initiated, it is initiated with a profile. So probably your instance has not a profile required for using developer tools. Btw why do you need to open developer tools via automation? you maybe cannot use those tools via automation.

If you eventhough want to try, you can try using java.awt class Robot to send keys. but that will be on OS level and not on browser level sendkeys.

  • I run automation tests in instream players. I'm trying to open developer tools in automation because I noticed that whenever I run my tests with it, the instream videos are loaded as expected every single time. I know it's not the best solution but it works. still, couldn't find any profile setting that is related to developer tools. if you're familiar with any, I'll be glad to know. – D.Guy Jul 12 '17 at 12:05
  • So you don't want videos to load? If this is the case take a look at this thread. https://stackoverflow.com/questions/12676369/how-to-disable-flash-in-selenium-remote-webdriver – Rahul Nair Jul 31 '17 at 08:18