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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:30:44+00:00 2026-06-03T05:30:44+00:00

I tried watir wiki example to access modal window. But was getting Argument error.

  • 0

I tried watir wiki example to access modal window. But was getting Argument error. I am trying with watir 3 version.

    puts b.modal_dialog(:title, "showModalDialog Method Sample Target Page").exists?
    puts b.modal_dialog(:title, "showModalDialog Method Sample Target Page").title
    b.modal_dialog(:title, "showModalDialog Method Sample Target Page").close
    b = Watir::Browser.new()
    b.goto("http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog.htm")
    b.button(:value,"Push To Create").click_no_wait

Error message

    C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/contai
    ner.rb:60:in `modal_dialog': wrong number of arguments (2 for 0) (ArgumentError) from C:/webtest/popup.rb:29:in `<main>'

Can some one help how to access modal window using watir 3

Thanks

  • 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-06-03T05:30:45+00:00Added an answer on June 3, 2026 at 5:30 am

    The error you’re receiving is saying that you’re supplying more arguments than are actually taken by the method.

    I’ve never had call to use the actual modal methods within Watir, but after quick experimentation with the page you supplied I was able to interact with the modal using the following:

    b.goto("http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog.htm")
    b.button(:id => "dCommand").click_no_wait
    puts b.modal_dialog.text
    

    In the above example I had it print out the text of the modal, but presumably any regular Watir command could be substituted.

    It would appear that the requirement for an argument indicating which modal to interact with has been removed in Watir 3.0 or earlier (presumbaly because you can only interact with one?). I moved to Watir-webdriver as I primarily test in Firefox, so I’m not sure when this might have changed, but it does appear to be the case that it does not accept any arguments in 3.0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone used Watir with IronRuby successfully? I am getting an error that the
I am trying to trigger a mouse over drop down window in Watir on
I'm new on Watir-webdriver. I have tried running watir-webdriver using Firefox on http://bit.ly/watir-example I
Tried this: scala> 2.isInstanceOf[AnyVal] <console>:8: error: type AnyVal cannot be used in a type
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
Tried a bunch of things but I can't get it to work consistently amid
tried to find the answer by googling and in MSDN but with no luck.
I have looked through the examples on these pages http://watir.com/examples/ http://wiki.openqa.org/display/WTR/Examples I still don't
so I am completely new to watir. And I am basically trying to implement
I'm trying to test my Rails App with test fixtures using Watir. The watir

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.