-
Using watir to test the javascript popup window has two ideas for reference:
1. See jscript_test.rb in unittests under the watir installation directory.
The most important method is
Def check_dialog (extra_file, expected_result, & Block)
Goto_javascript_page ()
Thread. New {system ("rubyw/" # {$ mydir} // # {extra_file}. Rb /"")}
Block. Call
Testresult = $ ie. text_field (: ID, "testresult"). Value
Assert_match (expected_result, testresult)
End
But do not understand the called statement:
Def test_alert_button ()
Check_dialog ('jscriptextraalert ',/Alert OK/) {$ ie. Button (: ID, 'btnalert'). Click}
End
It is also necessary to learn about Ruby.
2. Another method is to use win32ole to manipulate the javascript popup window.
The depressing thing is that many win32ole documents are in Japanese version, and you can only read the English and sweat from your head.