2012-05-04 5 views
1

モーダルウィンドウにアクセスするためのウォークウィキの例を試しました。しかし、引数エラーを取得していた。私はwatir 3バージョンで試しています。watir 3モーダルウィンドウへのアクセス

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 

エラーメッセージ

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>' 

することができますいくつかのワチール3つの

おかげ

答えて

2

あなたが供給していると言っている受信しているエラーを使用して、モーダルウィンドウにアクセスする方法1つのヘルプメソッドによって実際に取られるより多くの議論。

私はワチール内の実際のモーダルメソッドを使用するために呼び出すいたことがありませんが、ページでの迅速な実験の後、あなたは、私は、以下のものを使用して、モーダルと対話することができた供給:

上記で
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 

私はそれをモーダルのテキストをプリントアウトさせましたが、おそらく通常のWatirコマンドで代用することもできます。

Watir 3.0以前では、どちらのモーダルと対話するかを示す引数の要件が削除されているように見えます。私は主にFirefoxでテストしているので、Watir-webdriverに移動したので、いつ変更されたのか分かりませんが、3.0で何も引数を受け付けない場合があります。

関連する問題