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 285047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:30:40+00:00 2026-05-12T05:30:40+00:00

I have a screen that pops up on load with a print dialog using

  • 0

I have a screen that pops up on load with a print dialog using javascript.

I’ve just started using WatiN to test my application. This screen is the last step of the test.

What happens is sometimes WatiN closes IE before the dialog appears, sometimes it doesn’t and the window hangs around. I have ie.Close() in the test TearDown but it still gets left open if the print dialog is showing.

What I’m trying to avoid is having the orphaned IE window. I want it to close all the time.

I looked up DialogHandlers and wrote this:

var printDialogHandler = new PrintDialogHandler(PrintDialogHandler.ButtonsEnum.Cancel);
ie.DialogWatcher.Add(printDialogHandler);

And placed it before the button click that links to the page, but nothing changed.

The examples I saw had code that would do something like:

someDialogHandler.WaitUntilExists() // I might have this function name wrong...

But PrintDialogHandler has no much member.

I initially wasn’t trying to test that this dialog comes up (just that the page loads and checking some values on the page) but I guess it would be more complete to wait and test for the existence of the print dialog.

  • 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-12T05:30:40+00:00Added an answer on May 12, 2026 at 5:30 am

    Not exactly sure about your situation, but we had a problem with a popup window that also displayed a print dialog box when loaded. Our main problem was that we forgot to create a new IE instance and attach it to the popup. Here is the working code:

    btnCoverSheetPrint.Click(); //Clicking this button will open a new window and a print dialog
    IE iePopup = IE.AttachToIE(Find.ByUrl(new Regex(".+_CoverPage.aspx"))); //Match url ending in "_CoverPage.aspx"
    
    WatiN.Core.DialogHandlers.PrintDialogHandler pdhPopup = new WatiN.Core.DialogHandlers.PrintDialogHandler(WatiN.Core.DialogHandlers.PrintDialogHandler.ButtonsEnum.Cancel);
    using (new WatiN.Core.DialogHandlers.UseDialogOnce(iePopup.DialogWatcher, pdhPopup)) //This will use the DialogHandler once and then remove it from the DialogWatcher
    {
        //At this point the popup window will be open, and the print dialog will be canceled
        //Use the iePopup object to manage the new window in here.
    }
    
    iePopup.Close(); // Close the popup once we are done.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 162k
  • Answers 162k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Its definitely javascript. I think the banners on your site… May 12, 2026 at 11:59 am
  • Editorial Team
    Editorial Team added an answer No - a constraint is a database object as well,… May 12, 2026 at 11:59 am
  • Editorial Team
    Editorial Team added an answer Set your form's KeyPreview property to True. Then add this… May 12, 2026 at 11:59 am

Related Questions

What are the implications of running a Microsoft Access Database in both 2003 and
I make an AJAX request to see if a sesion variable has been set.
I have an application that needs to work with a vendor-supplied API to do
My program does some network activity in a background thread. Before starting, it pops
I am using FancyBox to generate a popup image. FancyBox (In case you are

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.