Can I programmatically open the devtools from a Google Chrome extension?

46,853

Solution 1

It seems unlikely that this is possible or will ever become possible,

check this: https://code.google.com/p/chromium/issues/detail?id=112277

which says: "We only allow explicit devtools opening."

Solution 2

Yes you can (or not) using the experimental APIs chrome.experimental.webInspector.
http://code.google.com/chrome/extensions/experimental.html
You can even change the content and panels of it.
Note that you will not able submit extensions that use experimental APIs.

Solution 3

This is quite old but since I stumbled upon it now searching for a solution I figured others might have too. Since Chrome 28 you can use the devtools.* API. This allows you to open and manipulate DevTools panels. It is also notable no longer expirimental.

Solution 4

Unfortunately, There is no way to do that...

The chrome://chromewebdata link only works if an instance of dev tools is already opened...

Solution 5

One could try

chrome.developerPrivate.openDevTools

Share:
46,853
Admin
Author by

Admin

Updated on July 09, 2021

Comments

  • Admin
    Admin almost 3 years

    I have a chrome extension which hooks into the devtools. Ideally I want a badge that, when clicked, opens up the devtools on the new tab which I created. Is there any way to do this from the background page?

  • neocotic
    neocotic almost 13 years
    However, it's worth noting that you can host these outside of the extensions gallery if you are determined. Although this would mean that users would also have to use the dev channel and enable the Experimental Extension APIs flag.
  • Rob W
    Rob W about 12 years
    experimental.webInspector is now called chrome.experimental.devtools. Some of the APIs are not experimental any more, and they are listed under chrome.devtools. Unfortunately, there is no way to automatically open the Dev tools via a Chrome extension.
  • Derek 朕會功夫
    Derek 朕會功夫 about 12 years
    @Rob W, Didn't notice chrome.devtools.* APIs have become outside of experiment APIs.
  • teg_brightly
    teg_brightly almost 4 years
    Do you remember what method is used to progammatically open the devtools from the background script? All other answers (from stackoverflow) seem to suggest that it's impossible...
  • Acuna
    Acuna almost 4 years
    @Sentero-esp12 just click right button on needed page and select "Inspect" from it)
  • emvaized
    emvaized over 2 years
    Could provide more details on this and how to use these scripts?
  • John
    John over 2 years
    This doesn't answer the question. The devtools.* APIs are for building extensions to the developer tools. They don't provide a way to launch it programatically. And the question was how to do it programmatically, so "just click right" isn't an answer.
  • J Heyer
    J Heyer over 2 years
    @emvaized sure thing, sorry for the wait just saw this; selenium-python.readthedocs.io/index.html