Highlight node with chrome devtools extension

I would like to isolate the dom element from my chrome dev-tools extension in the same way as the element inspector (in dev tools). Is there a special API for this? Thanks

+5
source share
1 answer

Whenever you evaluate some code on a verified page using the DevTools console, DevTools issue a bunch of helper calls known as the command line APIs . This API includes a call to inspect (), which has the same effect as if the user called "Inspect Element" from the context menu, i.e. Raised the "Elements" panel and selected node. The inspect () call along with the rest of the command line API is available for code evaluated using the DevTools extensions using chrome.devtools.inspectedWindow.eval (), so you can do things like:

chrome.devtools.inspectedWindow.eval("inspect(document.body)");

, "" (.. DOM, "" ), , API. , script.

+5

All Articles