Search code examples
.netseleniumpolymer

Hot to get HTML from page on Polymer with loaded js?


I have page written using Polymer. I want to open in "net browser", wait until all Js completes and get it HTML Tried with Selenium but it PageSource returns me original page HTML, before JS even started. However in browser I see that all scripts executed correctly.


Solution

  • As polymer uses shadowdom there is no html that could be returned as all the js code execution happens in the shadowdom that isn't a direct part of the dom and therefore the PageSource. You could of course render it with eg. https://github.com/GoogleChrome/rendertron in the serialize mode that extracts the shadowdom code and inserts it into the "real" dom.