-
1. Re: client.getContentPage is about:blank
ssilvert May 20, 2009 10:23 AM (in response to nerrve)I don't see anything wrong in what you posted. Does the page render properly when you hit /tests.jsf from the browser?
What do you mean by (. added purposely)? What is that and what is its purpose?
Stan -
2. Re: client.getContentPage is about:blank
nerrve May 20, 2009 11:27 AM (in response to nerrve)Sorry about the (.)
Actually the html tag was not rendering in the post, so i had to separate the letters out with dots :)
The page /tests.jsf renders perfectly well from the browser.
Ill get back here with some more information soon.
Thanks -
3. Re: client.getContentPage is about:blank
nerrve May 21, 2009 7:18 AM (in response to nerrve)Hi,
While analyzing the requests from the browser, i found that there were a few requests send to another servlet which effectively bypasses the faces servlet.
This servlet doesnt return anything.
So, the original page to which the request was forwarded i.e tests.jsf, is destroyed, and replaced by about:blank
Ref: WebWindowImpl#setEnclosedPage of htmlunit
Is there any way i can stop this from happening by setting some property etc etc? Or do you have something else in mind?
Thanks for your help. -
4. Re: client.getContentPage is about:blank
ssilvert May 21, 2009 9:09 AM (in response to nerrve)Are you using JSFUnit 1.0.0.GA? That is the kind of problem I used to see in one of the early beta versions. The way things are now, HtmlUnit should make sure that the final Page object returned is the same one you would see in the browser.
Are you using the latest HtmlUnit jar?
I could make it possible to replace the JSFUnitWebConnection with your own custom version. That would give you more control over the final Page object returned form getContentPage(). But that would be a pretty radical step. I'd rather figure out why HtmlUnit isn't behaving properly. Is there any way you can create a small test app that demonstrates the problem?
Stan -
5. Re: client.getContentPage is about:blank
nerrve May 21, 2009 10:22 AM (in response to nerrve)Yes. I am using the GA version. Although still using HtmlUnit 2.4 as suggested on the JSFUnit page.
Ill try upgrading to 2.5 and see if i can reproduce it.
Still working on identifying 'exactly' what triggers this behavior. Ill post back with more 'exact' information. :)
(Probably with some html this time)
Thanks -
6. Re: client.getContentPage is about:blank
nerrve May 22, 2009 10:16 AM (in response to nerrve)Hi,
I tried upgrading the HtmlUnit jars but to no avail.
Also, the problem is because of an element.
This element is created dynamically after the page has loaded and its source points to a jsp with the same context path as tests.jsp (My bad here - i had earlier pointed out that it points to another servlet). What i also noticed was that even if you leave the src blank, it shows the same behavior.
Is there a quick hack here that i can do? -
7. Re: client.getContentPage is about:blank
nerrve May 22, 2009 10:21 AM (in response to nerrve)Yikes!!! My earlier post became a victim of the i.frame tag being rendered...
Anyways, Im posting it again...
I tried upgrading the HtmlUnit jars but to no avail.
Also, the problem is because of an iframe element.
This element is created dynamically after the page has loaded and its source points to a jsp with the same context path as tests.jsp (My bad here - i had earlier pointed out that it points to another servlet). What i also noticed was that even if you leave the src blank, it shows the same behavior.
Is there a quick hack here that i can do? -
8. Re: client.getContentPage is about:blank
ssilvert May 22, 2009 11:40 AM (in response to nerrve)So perhaps HtmlUnit is leaving you inside this new iFrame?
You can explore the frames in the page by calling HtmlPage.getFrames().
To tell you the truth, I'm not sure I have a good handle on your problem. An example would be helpful. You also might want to ask about this on the HtmlUnit mailing list since this appears to be an HtmlUnit issue.
Stan -
9. Re: client.getContentPage is about:blank
nerrve May 25, 2009 8:32 AM (in response to nerrve)Hi,
Let me explain my scenario further
I had a page like this<h t m l>
<b o d y>
// Whatever
<i f r a m e src="" >
< /b o d y>
</h t m l>
The iframe was added by javascript after the page was loaded.
On click on some links of the page, it would download a page and put it in the iframe by setting the right src attribute.
Anyways, this is what eventually worked for meHtmlPage htmlPage = (HtmlPage) client.getContentPage();
HtmlPage enclosedPage = (HtmlPage)htmlPage.getEnclosingWindow().getParentWindow().getEnclosedPage();
Thanks for all ur help till date!!