Reputation: 101
I have been tasked with testing the contents of several pop-ups throughout our application. All the pop-ups are called using something similar to:
var win = new Window({ className: "spread", title: "Discussion",
left: 1, width: 410, height: 300, url: "Discussion.aspx?ID=" + id,
showEffectOptions: { duration: 0}})
Since I have been unable to access the pages through the pop-ups, I have started to directly navigate to the pages. The problem is that the pages are designed to close after processing within the page is completed. (window.close();
)
When testing the pages, since I am directly accessing the page, I get the The webpage you are viewing is trying to close the window. Do you want to close this window?
message.
Is there a way using Watir (not Watir-webdriven) to access the message and click Yes or No?
PS - (Using IE8 if that matters. I have attempted to find ways to disable the message, but to no avail)
UPDATE Using IE Developer Tools, the generalized html structure with a popup looks like:
<html><body>
<iframe><form>... (Main page here)
<div class="dialog">
<div class="spread_close" onclick="Window.close()"/>
<table><tr><td><iframe> (table is not part of the "spread_close" div)
<html><body><form><div><table><tr><td>
<textarea name="txtDiscussion" id = "txtDiscussion" >
using browser.div(:class => "spread_close").exists?
returns true
.
using browser.text_field(:name => "txtDiscussion").exists?
returns false
. I assume this is because of the dual <html>
.
Upvotes: 2
Views: 440
Reputation: 6660
You've got frames. That's likely what is blocking access, odds are these are not actually a popup but a 'lightbox' div that uses styles and such to look a lot lie a popup or modal dialog.
Look up the stuff on how to deal with frames on the watir wiki and you should be on your way.
Upvotes: 1