longvh211 / Chromium-Automation-with-CDP-for-VBA

A method to directly automate Chromium-based web browsers, such as Chrome, Edge, and Firefox, using VBA for Office applications by following the Chrome DevTools Protocol framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to extract HTML source?

vampire337 opened this issue · comments

In my existing VBA (which used the InternetExplorer object), I am able to extract the source HTML using the .innerHTML property. The objBrowser object in the example given here doesn't have a similar property exposing the HTML, so I'm assuming there is something I need to pass through a .jsEval call to return the source. Could anyone provide an example or maybe a pointer to where I would find a relevant js call to return the HTML source?

Disregard. Issue #3 contained my answer. It might be nice to have objBrowser.jsEval("document.evaluate(""/*"", document.body, null, 9, null).singleNodeValue.innerHTML" included in the Demo.bas examples.

v2.5 now has .html property to quickly extract the html text.