Access to Devtools in html2.Webview

Hello everyone! I’m wondering if the html2.Webview widget has access to devtools. I’m looking for a way to inspect the dom, and view the JS console.

There’s mention of a method “EnableAccessToDevTools” on the Webview widget, but then no instructions on how actually launch the tools. Maybe there’s some kind of hotkey I need to use? I’ve looked, and I can’t find mention of it anywhere.

Thanks!

I just modified the Webview example in the wxPython Demo by adding the following line after line 48:

            self.wv.EnableAccessToDevTools()

I then saved the change and ran the modified code.

I noticed that when I right-clicked on the web page, there was now an extra option “Inspect Element”. When I selected that option, the inspector panel appeared at the bottom of the Webview control.

Here is a stand-alone version of the modified example: HTML2_WebView.py (5.6 KB)

AMAZING! You have no idea what a help this is. Thus far I was having to embed a cefPython browser instance in the panel. Cef is powerful (overkill, really) but really uncooperative and the documentation is abysmal. Only needing a single library will simplify things nicely.

XD It never occurred to me to right click. I just always assumed there would be an in-code means of launching the tools (which, for the record, there probably should be).