Error with a modal window

13 views
Skip to first unread message

Carlo

unread,
Feb 16, 2011, 8:18:46 AM2/16/11
to Vapir
I have downloaded and tried Vapir because it promises support for
modal windows.
First the good news: all my Watir scripts work great with Vapir
without changes.
Then I tried with a modal window, and this was the result:

*** My code ***
if browser.modal_dialog.exists?
puts "Modal dialog found"
end
browser.modal_dialog.click_button('Cancel')
#sleep 3

*** Result ***
C:/Program Files/Ruby192/lib/ruby/gems/1.9.1/gems/vapir-firefox-1.7.2/
lib/vapir-firefox/modal_dialog.rb:52:in `click_button': Could not find
anonymous nodes on which to look for buttons (RuntimeError)
from I:/Vapir/siamtoatlas.rb:42:in `<main>'

The modal window contains a file upload requester (with a Browse...
button) and two buttons, Upload and Cancel.
I tried the easiest thing, the Cancel button, and still it fails.
Can anyone help?

Ethan

unread,
Feb 16, 2011, 12:50:57 PM2/16/11
to va...@googlegroups.com
What operating system, and what version of firefox? 

Also - is this a HTML document opened in a modal window? What javascript function was called to spawn the window? This is one of:
- alert()
- prompt()
- confirm()
showModalDialog()
Another possibility is javascript open(), in which case #modal_dialog isn't the correct method to be using - these sorts of popups aren't window-modal, and the normal Browser.attach and related methods can be used to interact with them. 

Carlo

unread,
Feb 18, 2011, 10:55:12 AM2/18/11
to Vapir
Windows 7 64-bit, FireFox 3.6.13
The modal window opens when I click on an image, that links like this:

<a
href="javascript:submitAction_win0(document.win0,'FILEUPLD_ATTACHADD');">

I looked at the JavaScript code, it is hard to follow, but I think it
uses open(), since there is a call to window.open, but the other names
do not appear in the "View Source" file

Ethan

unread,
Feb 18, 2011, 4:54:34 PM2/18/11
to va...@googlegroups.com
If it's a window.open-type popup, you should use Browser.attach to get and interact with it, and not #modal_dialog. A simple test is whether you can interact (manually) with the page that opened the popup - if you cannot, then the window is modal; if you can, it's not modal. (though terminology seems to be misused and abused a lot in this area, so it's hard to define things precisely.) 

Carlo

unread,
Feb 18, 2011, 6:11:37 PM2/18/11
to Vapir
The page is divided in 2 frames.
I click on the link (actually, an image) inside the right frame and
the little (modal?) window, that I would like to automate, appears.
Now the right frame is grayed out, and I cannot interact with it, but
I can still interact with the left frame.
Is it a modal window then?

Ethan

unread,
Feb 19, 2011, 2:11:28 PM2/19/11
to va...@googlegroups.com
It sounds like it isn't truly modal, it has some javascript to make it behave that way. Since it seems like it uses window.open, it isn't modal. 
Reply all
Reply to author
Forward
0 new messages