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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:32:35+00:00 2026-05-14T08:32:35+00:00

I have a, what seems to be, rather common scenario I’m trying to work

  • 0

I have a, what seems to be, rather common scenario I’m trying to work through.

I have a site that accepts input through two different text fields. If the input is malformed or invalid, I receive a Javascript pop-up notification.

I will not always receive one, but I should in the event of (like I said earlier) malformed data, or when a search result couldn’t be found.

How can I detect this in WatiN?

A quick Google search produced results that show how to click through them, but I’m curious as to whether or not I can detect when I get one?

In case anyone is wondering, I’m using WatiN to do some screen scraping for me, rather than integration testing 🙂

Thanks in advance!

Ian

  • 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-14T08:32:35+00:00Added an answer on May 14, 2026 at 8:32 am

    Here’s what I came up with.

    I read this question several times before I came up with the obvious solution..

    Can I read JavaScript alert box with WatiN?

    This is the code I came up with.. While it does force a delay of 3 seconds if the alert doesn’t happen, it works perfectly for my scenario.

    Hope someone else finds this useful..

    frame.Button(Find.ByName("go")).ClickNoWait();
    
    System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
    stopwatch.Start();
    
    while (stopwatch.Elapsed.TotalMilliseconds < 3000d)
    {
        if (alertDialogHandler.Exists())
        {
            // Do whatever I want to do when there is an alert box.
            alertDialogHandler.OKButton.Click();
            break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a scenario where I have several classes that extend from a common
I have what seems to me as a bit of an odd scenario, well
I have some common javascript functionality that I want to share across several views/pages.
Since a few years, common sense seems to dictate that it's better to program
I was just think that now it is common to have enough RAM on
I have some common structure that I'd like to use, and I need to
We have pretty big (~200mb) xml files from different sources that we want to
I have a project where there are multiple applications that have some common configuration
I have a question which seems to be rather fundamental but I can't seem
I have another Richfaces question which may seem rather weird. I am developing a

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.