WatiN testing of multi-level Frames page

I wanted to use  WatiN Web Application Testing In .Net, to test  html page with multi-level frames:

E.g TopFrame.aspx :
<Frameset>
     <FRAME SRC="ContentFrame.aspx">
</Frameset>

ContentFrame.aspx
<body>
     <IFRAME SRC="SubFrame.aspx">
</body>

When I tried to check ie.Frame("ContentFrame") it didn't show me html of ContentFrame.aspx(as expected), but showed html of parent  TopFrame.aspx. I've attached debug version of WatiN and stepped through to opening page. And in debugger  ie.Frame("ContentFrame")  was populated correctly.

I thought that the problem is with timeout of loading down-level page(SubFrame.aspx in my sample). Unfortunately 
increase of TimeOut didn't help.
I've done a few attempts in debugger and sometimes(when I had breakpoints in IE.CreateNewIEAndGoToUri and DomContainer.WaitWhileMainDocumentNotAvailable) it loaded html of content frame, but mostly showed parent's frameset.
There are some ideas to try in discussions: best way to find if webbrowser is totally ready and Webbrowser Wait!.

I've reported the problem to WatiN bug list 1747471 "Frame is not loaded for page with multi-level frames".

posted @ Friday, June 29, 2007 1:39 PM

Print

Comments on this entry:

# re: WatiN testing of multi-level Frames page

Left by Jeroen van Menen at 7/11/2007 10:03 AM
Gravatar
Hi, I used your unit test to reproduce your issue. The tested worked fine for me when I executed the test once. But I noticed the browser wasn't closed after the test. Which should be enforced because of the using statement and the automatic dispose of ie as a result of that. So I put a for loop around the using part to see what happend if I run the test several times (maybe it was some timing thing).
first cycle went fine, but in the second cycle (loop counter = 2) the Assert failed. Indeed the html property returns <frameset ....>.
Looking at the HTML with IE Develeper Toolbar I noticed something very strange (see the attached screenshot). The mainframe seems to be repeated somehow???

Then I tried this manually (not using WatiN to see if I could reproduce this by hand). And I did. Here are the steps:
- Open Internet Explorer
- Goto http://tsa.webjet.com.au/WebjetTSA/home.aspx
- The page is shown but another page is opened in a new window as well (http://www.webjet.com.au/homepage/popups/intermit_vb.html)?? Stating some problems with the website.
- Using IE developer bar, the html/dom structure of the home.aspx page looks as expected = OK
- I close the home.aspx page and leave intermit_vb.html page open.
- I open a new IE window using CTRL-N
- Goto http://tsa.webjet.com.au/WebjetTSA/home.aspx (no unexpected popup this time..?)
- Use IE developer bar again and this time a see the nested mainframe domstructure as shown in the attached screenshot.

Maybe you have found a (major) bug in IE, but it isn't WatiN that is doing something wrong here.

After this I tried what would happen if you create a new Internet Explorer instance each time you open home.aspx. This seems to work quite well, no nested dom structure!

With the current development code (in the SVN repository on SourceForge) you can create new IE instances in a new process like this

IE ie = new IE(startUrl, true); // true force IE in a new process.

Hope this helps you for now, but you should try to find out why the nested thing is happing.

Good luck, Jeroen van Menen

url for the image: http://sourceforge.net/tracker/download.php?group_id=167632&atid=843727&file_id=235615&aid=1747471

# re: WatiN testing of multi-level Frames page

Left by Michael Freidgeim at 8/14/2007 11:55 PM
Gravatar
Jeroen,
Thank you very much for your advice.
I've downloaded the latest version of IE.cs from http://watin.svn.sourceforge.net/viewvc/*checkout*/watin/trunk/src/Core/IE.cs?revision=446
and with createInNewProcess=true it works fine.

# re: WatiN testing of multi-level Frames page

Left by FTorres at 9/8/2007 3:34 AM
Gravatar
I would be curious to see how InCIsif.net would react to the problem.
<IFRAME> are sometime problematic.

# re: WatiN testing of multi-level Frames page

Left by diegoeche at 4/7/2008 8:34 AM
Gravatar
I dont know if it's the same. I tried to get a button that was in an inner IFrame and Watin didnt find it. What i did was that looked for the IFrame Element and then got the DOM from it. And problem solved.

# re: WatiN testing of multi-level Frames page

Left by Wally at 5/6/2008 1:14 PM
Gravatar
Hi diegoeche, could you post an example of the code you used?

# re: WatiN testing of multi-level Frames page

Left by Michael Freidgeim at 5/7/2008 5:48 PM
Gravatar
Wally,
Below is the example of using normal Frame.
IFrame , I hope, will be similar.
Frame mainFrame = ie.Frame("mainframe");
Button btnLogoff = mainFrame.Button(Find.ByName("ContentView$PageLayout$BottomNav$btnLogoff"));

Your comment:



 (will not be displayed)


 
 
 
Please add 2 and 7 and type the answer here:
 

Live Comment Preview:

 
«September»
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011