Delayed/dynamic popups not accessable in watij

9 views
Skip to first unread message

Frank

unread,
Oct 25, 2006, 11:36:52 AM10/25/06
to watij
I have started evaluating watij as a tool to replace our current
automation suite and I like what I am seeing however I am having an
issue with opening a popup the way my company uses them.
The popup they use take 3 steps to open
1. Open a window with a blank page
2. Change the document to some loading text
3. Redirect once the actual popup is loaded.
This works fine when I activate it manually however when I run watij
script to do it I get an access denied JS error in IE and step 2 never
takes place.

-------->HTML example (Note Page2.html and page3.html only have the
words page 2 and page 3.
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<Script>
var myPage;
function openPopup()
{
myPage = window.open("page2.html",
"thePage","width=200,height=200,resizable=1,status=1,menubar=1,location=1,titlebar=1,toolbar=1");
myPage.document.write("page2 dynamic text!");
setTimeout('myPage.location="page3.html"', 2000);
document.getElementById('testDiv').innerHTML = "continging writing";
}

</script>
</HEAD>
<BODY>
This is the Page to test popups!
<a href="javascript:void(0)" onclick="openPopup();">The Link</a>
<div id="testDiv"></div>
</BODY>
</HTML>

Watij code
IE _ie = new IE();
_ie.start("https://URL/PopupTest.html");
_ie.link(text,"/Link/").click();
IE new_ie = _ie.childBrowser();

Any help is appreciated. Thank you

Jake Dempsey

unread,
Oct 27, 2006, 9:43:31 PM10/27/06
to wa...@googlegroups.com
I am not 100% sure that I fully understand the problem.....
 
Here is what i did:
 
1. Created page1.html with the html you provided.
2. Created page2.html containing just the text "page2".
3. Created page3.html containing just the text "page3".
 
I think placed all three files in my htdocs dir under apache and fired it up. My test looks like:
 
IE ie = new IE();
ie.link("The Link").click();
IE newIE = ie.childBrowser();
assertTrue(ie.containsText("page3"));
 
This test had no problems and did not fail.  Am I missing something to get this to fail?  Do you get a watij error, or a JS alert error? 
 
Jake Dempsey

milvia

unread,
Dec 6, 2006, 2:19:13 PM12/6/06
to watij
I believe it is a similar problem I posted for help on Sep 26. We
launch a popup from the main window and then submit a form from the
main window to the popup. We always get the access denied javascript
error. No such error when manually run it nor using watir.

We figured a way to get rid of it by changing the application code by
setting domain value in javascript. But changing the application code
to get the test work does not sound to be a solution. The project could
not proceed from there.

Jake Dempsey

unread,
Dec 6, 2006, 3:35:10 PM12/6/06
to wa...@googlegroups.com
There must be something I am missing, because I ran the test in the first post with no such errors. Please help me understand how I can construct a better test to isolate the problem.
 
Jake

 
--
Jake Dempsey
www.watij.com

Frank

unread,
Dec 7, 2006, 12:19:27 PM12/7/06
to watij
It is a timming issue I can run the same test 10 times and have it pass
3 and fail 7. The access denied comes from the javascript trying to
write to an object that isn't fully loaded. doing it by hand works fine
however when you put it into watij I guess something is trying to push
the value through. We had to change the our application to have a test
mode that has standard popups without the intermediate page2.

Reply all
Reply to author
Forward
0 new messages