Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7006511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:29:14+00:00 2026-05-27T21:29:14+00:00

I am new to Watir, and am working on developing a testing tool for

  • 0

I am new to Watir, and am working on developing a testing tool for my work.
I have run into a problem that I cannot seem to solve, even after checking several sites.

The javascript window creation is below: (the window created holds a pdf in a window, so the only “buttons” are the minimize, maximize, close)

<a id="LogIn_HyperLink2" class="ms-WPTitle" onclick="javascript:var win = new Window({className: 'spread', title: 'Security Statement', top:0, left:1, width:750, height:365, url:'--redacted--/security.pdf', showEffectOptions: {duration:1.0}}); win.setConstraint(true, {left:10, right:20}); win.showCenter(); return false;" href="--redacted--/security.pdf" style="color:#6699cc; font-weight:bold;">Security Statement</a><br>

I have tried using both

puts browser.modal_dialog(:title, "Security Statement").exists?
puts browser.javascript_dialog.exists?

both have returned ‘false’

What approach should I be taking to attach to this new window, or more directly: How can I close this new window?

You can see the page at this link (IE only)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:29:15+00:00Added an answer on May 27, 2026 at 9:29 pm

    If the window holds a PDF file it’s a browser window, not a modal javascript popup (alert, confirm, prompt)

    It’s defined to start without all the normal menus etc active, but it’s still a browser window. You can attach to it as described in the Watir Wiki section about new browser windows, using the url or the title since you know both of those (given the HTML you showed us).

    If you are using Watir-Webdriver use it’s window switching commands. Right now the watirspec for that is your best reference to the methods supported and how they work.

    EDIT
    Thanks for the link. While the above would be true for a new browser window, that’s not what you are faced with. What you have there is all inside the browser HTML, created in the DOM on the fly with javascript. It’s all standard HTML elements, easily interacted with once you know what’s going on (this is actually IMHO easier to deal with than a popup or separate window)

    Use the IE developer tools, after you click the link that makes that ‘window’ appear, click the icon in the toolbar of the dev tools to refresh the DOM in the dev tools and you will be able to see that.

    The outermost container appears to be a div of class ‘dialog’, which is unique in the DOM at that point.

    The window controls are three divs under that one, with classes ‘spread_close’, ‘spread_minimize’, ‘spread_maximize’. There are three tables that hold the graphic elements for the top, sides, and bottom of the ‘window’ but there is ZERO actual content there, it’s just a visual windowframe.

    There is also an iframe that superimposes that window, which is I think were the content would be (I can’t get it to load, maybe because I’m not authorized for it or something)

    If you just want to close the window, try this:

    browser.div(:class => 'spread_close').click
    

    Since this is coming into existing due to a bunch of client side JS code you may need to use something like the ‘when_present’ method after clicking the link before you first start to interact with it. eg if all you want to do is click the link to open it, and then close it, you’d do something like this

    browser.link(:text => 'Security Statement').click
    browser.div(:class => 'spread_close').when_present.click
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a wrapper for a COM object that can only
I am working on a program in Ruby with Watir that has a series
I have a set of cucumber tests that normally run fine against our site.
We have tests using WatiN that we want to run on our CruiseControl.NET server.
I'm new on Watir-webdriver. I have tried running watir-webdriver using Firefox on http://bit.ly/watir-example I
I'm new to Watir and I've having a little trouble getting logged in in
New day, new problem :-) Code: Client Side: void abw_Closed(object sender, EventArgs e) {
Here is the .rb program: require 'watir' b = Watir::Browser.new the 2nd line will
I'm trying for the first time to use Watir for automated browser-based testing. For
I have a little page I've been working on. It's at: http://nait.jtlnet.com/~fpkj5v0r/programmer.php - and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.