Wrote an entire WebKitToHtml system previously, but should have used available open source projects like so.  Live and learn and take some time to consider alternatives before committing to a plan.

Python option

https://github.com/paulhammond/webkit2png/

JavaScript Chrome Extension Chrome Store link

https://chrome.google.com/webstore/detail/full-page-screen-capture/fdpohaocaechififmbbbbbknoalclacl

Project code link

https://github.com/mrcoles/full-page-screen-capture-chrome-extension

Or use Vivaldi browser which has built in screen capture system.

https://vivaldi.com/?lang=en_US