Python or Java module to render HTML page on server side and obtain DOM object
If you want to process (execute) the javascript on headless server to generate the HTML snapshot, try using a tool like Selenium.
Selenium will allow you to fully render the HTML webpage on server side and then you can use the generated HTML to make a snapshot.
I am looking for a library in Python OR Java that can use webkit or similar rendering engine on the server side (without GUI) and return the DOM object for further processing like selecting the elements etc.