I am writing a program to validate web pages on a remote server. It uses selenium RC to run Firefox with a battery of tests, so I can call arbitrary javascript. When there is a failure I would like to log the page's generated HTML. Now getting access to the DOM HTML is easy, But I am having real trouble finding a way to get at the source. Thanks.
I should reiterate that I am not looking for the DOM, but the original unmodified source code. As can be seen through Right click -> view page source. Specifically if
<Html>
<body>
<table>
<tr>
<td>
fear the table data
</td>
</table>
is the real HTML. Calls to document.documentElement.outerHTML || document.documentElement.innerHTML
and selenium.getHTMLSource()
will result in <head> </head><body> <table> <tbody><tr> <td> fear the table data </td> </tr></tbody></table> </body>
XHR request the same page for the source, and just check document.documentElement.outerHTML || document.documentElement.innerHTML
for the current state's source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With