tags:

views:

285

answers:

2

I opened a page and am following a couple of links with the click() method.

$this->selenium->open("test.html");
$this->selenium->click("link=testlink1");
$this->selenium->waitForPageToLoad("10000"); 
$this->selenium->click("link=testlink2");
$this->selenium->getHtmlSource();

Now I want to get the HTML source of the current page that I am on, but getHtmlSource seems to only get the source of the initial page from the open() call.

How do I get the HTML source of the page from 'testlink2'? The last link I followed and the current page I'm on.

A: 

Ok, so it appears if you do this, things work.

$link2 = $this->selenium->click("link=testlink2");
$this->selenium->getHtmlSource($link2);

Now, I'm running into a problem that getHtmlSource doesn't seem to returning everything. Looks like it has some sort of buffer limit :(

Also, it doesn't look like this technique will work on links to pages that require authentication. So if you login first, then click on some links, it doesn't work.

Brian
`getHtmlSource` doesn't take any parameters. My guess is that as you're not waiting for the page to load you are getting unexpected results such as no page source or only part of it.
Dave Hunt
A: 

getHtmlSource should return the current page's HTML source. Your example might need an additional waitForPageToLoad between clicking the link and getting the page source.

Dave Hunt