Store locally web pages that contain JavaScript code

Hi. I’m trying to store locally a web page that contains JavaScript code. Actually, I would like to store not the JavaScript code, but the HTML page generated after the code is run. This can be done via a browser, but cannot be done e.g. using http_open/copy_stream or load_structure/html_write.
So, my question is: “is there a way to do this via Prolog”? I know that Selenium is a library that can achieve this, but in other programming languages. Is there anything similar in SWI-Prolog?

Thank you.
Best regards,
Nick