modal dialog title locate error

modal dialog title locate issue:

>ruby new_awp_registration.rb
C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/modal_dialog.rb:55:in `locate': Title value must be String (ArgumentError)
    from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/modal_dialog.rb:86:in `initialize'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/container.rb:186:in `new'
    from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/container.rb:186:in `modal_dialog'
    from new_awp_registration.rb:16
>Exit code: 1

 

Solution:

Title value should be a string, but not a regular expression, and use click_no_wait method to click the button or image which can make the modal window pop up.

ie.button(:id, “id value”).click_no_wait              # a modal window pop up

sleep 5   

modal = ie.modal_dialog(:title, “full name”)

mt = modal.text_field(:id, “id value”)                  # operate in modal dialog

mt.set(“nikey.lee”)                                              

你可能感兴趣的:(dialog)