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?
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."
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.
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. –
Tarim chrome.devtools.*
APIs have become outside of experiment APIs. –
Negligent There is no way to do that.
The chrome://chromewebdata
link only works if an instance of DevTools is already opened.
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.
One could try
chrome.developerPrivate.openDevTools
Perhaps, the extension could kick off a Selenium script and you could use the "send_keys()" function as something like this:
ActionChains(driver).key_down(Keys.CONTROL).key_down(Keys.SHIFT).\
send_keys('J').key_up(Keys.CONTROL).key_up(Keys.SHIFT).perform()
... as "Ctrl+Shift+J" is the default keybind to open dev-tools (as of Jul 08, 2021)
I tried to make a script that simulates a CRTL+ALT+J
which opens the devtools but it didn't work. After that I found this:
It is not possible due to security restrictions. Browsers do not allow scripts to programmatically open the console or trigger certain keyboard shortcuts for security reasons. These restrictions are in place to prevent malicious activities.
If you need to interact with the console, you can do that only manually, or use the browser's developer tools.
It's not impossible with side extension, but if the reason is that you've tired to click Ctrl + Shift + I again and again every time - you can simply open the right button menu on needed page and select "Inspect" from it, it'll open the console like extension button, and also you don't need to search for its icon every time you need it, which is more conviniently than using an extension.
© 2022 - 2024 — McMap. All rights reserved.
chrome.developerPrivate.openDevTools()
– Squire