How can I get the HTML page source?

150 views
Skip to first unread message

jtabatabai

unread,
May 2, 2006, 3:47:18 PM5/2/06
to selenium-users...@googlegroups.com
Do you know how I might go about getting the entire HTML source (tags included) of the current page displayed in the browser? I tried getBodyText(), but this does not return the tags, only the contents (innerText) of the tags. I also tried getEval("document.body.innerHTML"), but that returns the source of SeleneseRunner.html. I would like to have the page source for logging purposes.

Joe Attardi

unread,
May 2, 2006, 3:51:16 PM5/2/06
to selenium-users...@googlegroups.com
Jeff,

You want the source of just the bottom frame. That will be the code of your
AUT. Not sure offhand what the frame is named, but you can go from the
SeleneseRunner to the top level window and perhaps access the frame from
there.

Just a thought; no guarantees as to its correctness. :)

/joe
On 5/2/06, <b class="gmail_sendername">Jeff Tabatabai</b> &lt;<a href="mailto:forum-selen...@openqa.org">forum-selen...@openqa.org</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Do you know how I might go about getting the entire HTML source (tags included) of the current page displayed in the browser?  I tried getBodyText(), but this does not return the tags, only the contents (innerText) of the tags.  I also tried getEval(&quot;
document.body.innerHTML&quot;), but that returns the source of SeleneseRunner.html.  I would like to have the page source for logging purposes.</blockquote><div><br>Jeff,<br><br>You want the source of just the bottom frame. That will be the code of
your AUT. Not sure offhand what the frame is named, but you can go from
the SeleneseRunner to the top level window and perhaps access the frame
from there.<br>
<br>
Just a thought; no guarantees as to its correctness. :)<br>
<br>
/joe </div><br></div>


jtabatabai

unread,
May 2, 2006, 5:08:45 PM5/2/06
to selenium-users...@googlegroups.com
Using this command, selenium.getEval("window.parent.frames[0].document.URL"),
I am able to get the URL of the AUT. However, when I attempt to get the innerHTML using this command, selenium.getEval("window.parent.frames[0].document.body.innerHTML"), Selenium hangs. Boooooo!!!! Any ideas?

Reply all
Reply to author
Forward
0 new messages