watir 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/readme.rb +211 -0
  2. data/unittests/WindowLogonExample.rb +30 -0
  3. data/unittests/WindowLogonExtra.rb +7 -0
  4. data/unittests/all_tests.rb +10 -0
  5. data/unittests/all_tests_concurrent.rb +57 -0
  6. data/unittests/attachToExistingWindow_test.rb +40 -0
  7. data/unittests/buttons_test.rb +131 -0
  8. data/unittests/checkbox_test.rb +149 -0
  9. data/unittests/core_tests.rb +9 -0
  10. data/unittests/css_test.rb +60 -0
  11. data/unittests/div_test.rb +179 -0
  12. data/unittests/errorchecker_test.rb +29 -0
  13. data/unittests/filefield_test.rb +35 -0
  14. data/unittests/form_test.rb +279 -0
  15. data/unittests/frame_test.rb +141 -0
  16. data/unittests/html/blankpage.html +12 -0
  17. data/unittests/html/buttons1.html +40 -0
  18. data/unittests/html/checkboxes1.html +69 -0
  19. data/unittests/html/complex_table.html +36 -0
  20. data/unittests/html/cssTest.html +42 -0
  21. data/unittests/html/div.html +105 -0
  22. data/unittests/html/fileupload.html +45 -0
  23. data/unittests/html/formTest1.html +39 -0
  24. data/unittests/html/forms2.html +45 -0
  25. data/unittests/html/forms3.html +132 -0
  26. data/unittests/html/forms4.html +27 -0
  27. data/unittests/html/frame_buttons.html +4 -0
  28. data/unittests/html/frame_links.html +4 -0
  29. data/unittests/html/frame_multi.html +5 -0
  30. data/unittests/html/iframeTest.html +13 -0
  31. data/unittests/html/iframeTest1.html +7 -0
  32. data/unittests/html/iframeTest2.html +6 -0
  33. data/unittests/html/images/1.gif +0 -0
  34. data/unittests/html/images/2.GIF +0 -0
  35. data/unittests/html/images/3.GIF +0 -0
  36. data/unittests/html/images/button.jpg +0 -0
  37. data/unittests/html/images/circle.jpg +0 -0
  38. data/unittests/html/images/minus.GIF +0 -0
  39. data/unittests/html/images/originaltriangle.jpg +0 -0
  40. data/unittests/html/images/plus.gif +0 -0
  41. data/unittests/html/images/square.jpg +0 -0
  42. data/unittests/html/images/triangle.jpg +0 -0
  43. data/unittests/html/images1.html +52 -0
  44. data/unittests/html/javascriptevents.html +39 -0
  45. data/unittests/html/link_pass.html +11 -0
  46. data/unittests/html/links1.html +37 -0
  47. data/unittests/html/links2.html +11 -0
  48. data/unittests/html/nestedFrames.html +6 -0
  49. data/unittests/html/pass.html +10 -0
  50. data/unittests/html/popups1.html +60 -0
  51. data/unittests/html/radioButtons1.html +71 -0
  52. data/unittests/html/select_tealeaf.html +54 -0
  53. data/unittests/html/selectboxes1.html +55 -0
  54. data/unittests/html/simple_table.html +26 -0
  55. data/unittests/html/simple_table_buttons.html +104 -0
  56. data/unittests/html/simple_table_columns.html +76 -0
  57. data/unittests/html/table1.html +142 -0
  58. data/unittests/html/textarea.html +30 -0
  59. data/unittests/html/textfields1.html +87 -0
  60. data/unittests/html/textsearch.html +44 -0
  61. data/unittests/ie_mock.rb +93 -0
  62. data/unittests/ie_test.rb +50 -0
  63. data/unittests/images_test.rb +179 -0
  64. data/unittests/iostring.rb +30 -0
  65. data/unittests/iostring_test.rb +48 -0
  66. data/unittests/js_events_test.rb +77 -0
  67. data/unittests/jscriptExtraAlert.rb +6 -0
  68. data/unittests/jscriptExtraConfirmCancel.rb +7 -0
  69. data/unittests/jscriptExtraConfirmOk.rb +7 -0
  70. data/unittests/jscriptPushButton.rb +5 -0
  71. data/unittests/jscript_test.rb +57 -0
  72. data/unittests/links_test.rb +169 -0
  73. data/unittests/minmax_test.rb +31 -0
  74. data/unittests/navigate_test.rb +56 -0
  75. data/unittests/non_core_tests.rb +9 -0
  76. data/unittests/pagecontainstext_test.rb +49 -0
  77. data/unittests/popups_test.rb +44 -0
  78. data/unittests/radios_test.rb +164 -0
  79. data/unittests/screen_capture_test.rb +53 -0
  80. data/unittests/selectbox_test.rb +197 -0
  81. data/unittests/send_keys_test.rb +29 -0
  82. data/unittests/setup.rb +47 -0
  83. data/unittests/table_test.rb +306 -0
  84. data/unittests/textAreafields_test.rb +81 -0
  85. data/unittests/textfields_test.rb +239 -0
  86. data/watir.rb +3744 -0
  87. data/watir/AutoItX3.dll +0 -0
  88. data/watir/WindowHelper.rb +47 -0
  89. data/watir/camel_case.rb +37 -0
  90. data/watir/clickJSDialog.rb +19 -0
  91. data/watir/cookiemanager.rb +53 -0
  92. data/watir/exceptions.rb +60 -0
  93. data/watir/screen_capture.rb +115 -0
  94. data/watir/setFileDialog.rb +16 -0
  95. data/watir/testUnitAddons.rb +47 -0
  96. data/watir/watir_simple.rb +475 -0
  97. data/watir/winClicker.rb +505 -0
  98. metadata +152 -0
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <title>Test page for forms</title>
5
+ </head>
6
+ <body>
7
+ CVS Revision: $Revision $
8
+ <br>
9
+ <br>
10
+ <table>
11
+ <tbody>
12
+ <tr>
13
+ <td>
14
+ <form name="apple_form" method="get" action="pass.html"> <input
15
+ name="name" value="apple" type="text"> </form>
16
+ </td>
17
+ </tr>
18
+ <tr>
19
+ <td>
20
+ <form name="banana_form" method="get" action="pass2.html"> <input
21
+ name="name" value="banana" type="text"> </form>
22
+ </td>
23
+ </tr>
24
+ </tbody>
25
+ </table>
26
+ </body>
27
+ </html>
@@ -0,0 +1,4 @@
1
+ <frameset cols=50,50 >
2
+ <frame src = buttons1.html name = buttonFrame>
3
+ <frame src = blankpage.html name = buttonFrame2>
4
+ </frameset>
@@ -0,0 +1,4 @@
1
+ <frameset cols=50,50 >
2
+ <frame src = links1.html name = buttonFrame>
3
+ <frame src = blankpage.html name = buttonFrame2>
4
+ </frameset>
@@ -0,0 +1,5 @@
1
+ <frameset cols=50,25,25 >
2
+ <frame src = buttons1.html name = buttonFrame id = first_frame>
3
+ <frame src = blankpage.html name = buttonFrame2 id = second_frame>
4
+ <frame src = pass.html>
5
+ </frameset>
@@ -0,0 +1,13 @@
1
+ <html>
2
+ <body>
3
+
4
+
5
+ <table >
6
+ <tr>
7
+ <td>
8
+ <iframe src = iframeTest1.html name = senderFrame width = 300 height = 300>
9
+
10
+ <td>
11
+ <iframe src = iframeTest2.html name = receiverFrame width = 300 height = 300>
12
+ </table>
13
+ </html>
@@ -0,0 +1,7 @@
1
+ <html>
2
+ <body>
3
+ <form name = sender>
4
+ <input type = text name = textToSend>
5
+ <input type = button name = sendIt value = "SendIt" onClick="javascript:parent.receiverFrame.document.body.all.receiverText.value= document.body.all.textToSend.value;">
6
+ </body>
7
+ <html>
@@ -0,0 +1,6 @@
1
+ <html>
2
+ <body>
3
+
4
+ <input type = text name = receiverText>
5
+ </body>
6
+ <html>
@@ -0,0 +1,52 @@
1
+ <html>
2
+ <head>
3
+ <title>
4
+ Test page for Images
5
+ </title>
6
+ </head>
7
+ <body>
8
+ CVS Revision: "$Revision $"
9
+ <br>
10
+ <br>
11
+ <table>
12
+ <tr>
13
+ <td>
14
+ <img src = images/triangle.jpg>
15
+ <td> The triangle only has a src
16
+
17
+ <tr>
18
+ <td>
19
+ <img src = images/square.jpg id=square>
20
+ <td> The square has a src and an id
21
+
22
+ <tr>
23
+ <td>
24
+ <img src = images/circle.jpg name = circle>
25
+ <td> The circle has a src and a name
26
+
27
+
28
+ <tr>
29
+ <td>
30
+ <img src = images/missing.jpg name = themissingimage>
31
+ <td> this is a missing image
32
+
33
+
34
+ <tr>
35
+ <td>
36
+ <img src = images/button.jpg onClick='javascript:document.location="pass.html";'>
37
+ <td> this image has a javascript on click event
38
+
39
+ <tr>
40
+ <td>
41
+ <img src = images/circle.jpg alt="circle">
42
+ <td> The circle has a src and an alt text
43
+
44
+ <tr><td>
45
+ <INPUT onClick= javascript:document.all.text1.value='clicked' type=image src="images/square.jpg" value="Position Show Optional" name=tsogpsb>
46
+ <td> This is a button as an image, with a value attribute
47
+ <input type = text name = text1>
48
+
49
+
50
+
51
+ </body>
52
+ </html>
@@ -0,0 +1,39 @@
1
+ <HTML>
2
+ <HEAD>
3
+ <SCRIPT LANGUAGE="JavaScript">
4
+
5
+ function enable() {
6
+ frm=document.forms[0]
7
+ {frm.Button1.disabled=false}
8
+ }
9
+
10
+ </SCRIPT>
11
+
12
+ </HEAD>
13
+ <BODY TEXT="000000" BGCOLOR="FFFFFF">
14
+ <p align="center">
15
+ <form>
16
+
17
+ <input type="text" name="entertext" onkeyup="javascript:enable();" >
18
+
19
+
20
+ <input type=button value="Button 1" name="Button1" disabled="true" onClick="javascript:document.location='pass.html';">
21
+
22
+ </form>
23
+ </p>
24
+ <p>
25
+ <a href="pass.html"
26
+ onMouseOver="window.status='It worked'; return true">Check the Status</a>
27
+
28
+ </p>
29
+ <p>
30
+ <a href="pass.html"
31
+ onMouseOver="window.status=''; return true">Clear the Status</a>
32
+
33
+ </p>
34
+
35
+ <p>
36
+ <a href = '#' onClick= "javascript:window.open('pass.html','pop_up_test','height=100,width=50,fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); ">New Window No Status Bar</a>
37
+
38
+ </BODY>
39
+ </HTML>
@@ -0,0 +1,11 @@
1
+ <html>
2
+ <head>
3
+ <title>
4
+ Test page for Links - 3
5
+ </title>
6
+ </head>
7
+ <body>
8
+ Links3-Pass
9
+
10
+ </body>
11
+ </html>
@@ -0,0 +1,37 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ <title>Test page for Links</title>
5
+ </head>
6
+ <body>
7
+ CVS Revision: $Revision $
8
+ <br>
9
+ <br>
10
+ <table>
11
+ <tbody>
12
+ <tr>
13
+ <td> <a href="links2.html">test1</a> <br>
14
+ <a href="link_pass.html">test1</a> <br>
15
+ <a href="pass3.html"><img src="images/button.jpg" border=0></a> The button is really a link <br>
16
+ <a href="textarea.html" target="_blank">new window</a> <a href="textarea.html" target="_blank">new window</a> </td>
17
+ </tr>
18
+ <tr>
19
+ <td> <a href="links1.HTML" id="link_id">Link Using an ID</a> </td>
20
+ </tr>
21
+ <tr>
22
+ <td> <a href="links1.HTML" name="link_name">Link Using a name</a>
23
+ </td>
24
+ </tr>
25
+ <tr>
26
+ <td> <a href="links1.HTML" title="link_title">Link Using a title</a>
27
+ </td>
28
+ </tr>
29
+
30
+ <tr>
31
+ <td><a href = pass.html><img src=images/triangle.jpg>Image and a text link</a>
32
+ </tr>
33
+
34
+ </tbody>
35
+ </table>
36
+ </body>
37
+ </html>
@@ -0,0 +1,11 @@
1
+ <html>
2
+ <head>
3
+ <title>
4
+ Test page for Links - 2
5
+ </title>
6
+ </head>
7
+ <body>
8
+ Links2-Pass
9
+
10
+ </body>
11
+ </html>
@@ -0,0 +1,6 @@
1
+ <html><head><title>Nested Frames</title></head>
2
+ <frameset cols=70,30 >
3
+
4
+ <frame src = iframeTest.html name = nestedFrame>
5
+ <frame src = blankpage.html name = nestedFrame2>
6
+ </frameset>
@@ -0,0 +1,10 @@
1
+ <html>
2
+ <head>
3
+ <title>
4
+ Pass Page
5
+ </title>
6
+ </head>
7
+ <body>
8
+ PASS
9
+ </body>
10
+ </html>
@@ -0,0 +1,60 @@
1
+ <html>
2
+ <head>
3
+ <title>
4
+ Test page for pop ups
5
+ </title>
6
+
7
+ <script language = javascript>
8
+ function doConfirmBox() {
9
+ var a =confirm('Do you really want to do this');
10
+ if (a == true)
11
+ document.all.confirmtext.value = "OK"
12
+ else
13
+ document.all.confirmtext.value = "Cancel";
14
+ }
15
+
16
+ function doPromptBox() {
17
+ var a =prompt('Enter something delightful' , '');
18
+ if (a == null)
19
+ document.all.prompttext.value = "Cancel"
20
+ else
21
+ document.all.prompttext.value = a;
22
+ }
23
+
24
+
25
+ </script>
26
+
27
+ </head>
28
+ <body>
29
+ CVS Revision: "$Revision: 1.1 $"
30
+ <br>
31
+ <br>
32
+ <table>
33
+
34
+ <tr>
35
+ <td>
36
+ <input type = button value = "Alert" onClick = "javascript:alert('This is an alert box');">This Button shows an alert pop up</q>
37
+ <br>
38
+
39
+ <tr>
40
+ <td>
41
+ <input type = button value = "Prompt" onClick= "javascript:doPromptBox();">This button shows a prompt pop up. This text box shows what text was entered <input type = text name = prompttext>
42
+
43
+ <br>
44
+ <tr>
45
+ <td>
46
+ <input type = button value = "Confirm" onClick= "javascript:doConfirmBox();">This button shows a prompt pop up. This text box shows which button was clicked <input type = text name = confirmtext>
47
+ <br>
48
+
49
+ <tr>
50
+ <td>
51
+ <input type = file name = up>This button shows a file upload box</q>
52
+ <br>
53
+
54
+
55
+ <tr>
56
+ <td>
57
+ </table>
58
+
59
+
60
+ </html>
@@ -0,0 +1,71 @@
1
+ <html>
2
+ <head>
3
+ <title>
4
+ Test page for Radio Buttons
5
+ </title>
6
+
7
+ <script>
8
+
9
+ function setButtonState( )
10
+ {
11
+ if (document.all.foo.disabled )
12
+ document.all.foo.disabled = false
13
+ else
14
+ document.all.foo.disabled = true
15
+ }
16
+ </script>
17
+
18
+ </head>
19
+ <body>
20
+ CVS Revision: $Revision $
21
+ <br>
22
+ <br>
23
+ <table>
24
+ <tr>
25
+ <td>
26
+ Radio (using name) <input type = radio name = box1>
27
+ <br>
28
+ Radio (using id) <input type = radio id = box5>
29
+
30
+ <tr>
31
+ <td>
32
+ Disabled<input type = radio name = box2 disabled>
33
+
34
+ <tr>
35
+ <td>
36
+ Set<input type = radio name = box3 checked>
37
+
38
+ <tr>
39
+ <td>
40
+ <br>
41
+ <br>
42
+ These radios have the same name, but different values
43
+ <br>
44
+ Name = box4 value=1 <input type = radio name = box4 value = 1 checked>
45
+ <br>
46
+ Name = box4 value=2 <input type = radio name = box4 value = 2>
47
+ <br>
48
+ Name = box4 value=3 <input type = radio name = box4 value = 3>
49
+ <br>
50
+ Name = box4 value=4 <input type = radio name = box4 value = 4>
51
+ <br>
52
+ Name = box4 value=5 <input type = radio name = box4 value = 5 disabled title="box4-value5">
53
+
54
+
55
+ <tr>
56
+ <td>
57
+ Name = box5 value=1 Enable Button <input type = radio name = box5 value = 1 onClick='javascript:setButtonState( )'>
58
+ <br>Name = box5 value=2 Disable Button<input type = radio name = box5 value = 2 onClick='javascript:setButtonState( )'>
59
+
60
+
61
+ <tr>
62
+ <td>
63
+ <input type = button name = foo value = foo disabled><td> This button is used with radio box5. This button gets enabled/disabled on each click
64
+
65
+
66
+
67
+
68
+
69
+ </table>
70
+ </body>
71
+ </html>
@@ -0,0 +1,54 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
+ <html>
3
+ <head>
4
+ </head>
5
+ <body>
6
+ I've been very happy to be able to start migrating from Incanica's ITP<br>
7
+ to Watir at work, but I've run into my first real problem. I have a<br>
8
+ select box defined thus:<br>
9
+ <br>
10
+ <select class="body" name="op_numhits">
11
+ <option value="0"> = </option>
12
+ <option value="1"> &lt;&gt; </option>
13
+ <option value="3"> &gt;= </option>
14
+ <option value="5"> &lt;= </option>
15
+ </select>
16
+ <br>
17
+ and I'm trying to choose the "&gt;=" option via the following code:<br>
18
+ <pre> $ie.selectBox( :name, "op_numhits" ).select( "&gt;=" )</pre>
19
+ (Aside: actually, what I write to define the task is XML adapted from
20
+ ITP's syntax, e.g.,<br>
21
+ <pre> &lt;browser_action entity="selectBox" entity_id_type="name" entity_id_value="op_numhits" action="select" param="&amp;gt;=" /&gt; </pre>
22
+ and our WebSiteTester Ruby class translates that into
23
+ Watir calls.)<br>
24
+ <br>
25
+ and the output I get from Watir is:<br>
26
+ <br>
27
+ Setting box op_numhits to &gt;= String<br>
28
+ comparing &gt;= to &aacute;=&aacute;&aacute;<br>
29
+ comparing &gt;= to &aacute;&lt;&gt;&aacute;<br>
30
+ comparing &gt;= to &aacute;&gt;=&aacute;<br>
31
+ comparing &gt;= to &aacute;&lt;=&aacute;<br>
32
+ <br>
33
+ <br>
34
+ While I just realized I could enhance our WebSiteTester class to be
35
+ able to pass Regexp's as well as Strings to the select() method, it
36
+ would also be nice to be able to specify the desired select option by
37
+ value (in my example, the value is "3").<br>
38
+ <hr><br>
39
+ Is it even possible for Watir to select something based on an attribute<br>
40
+ that's empty, like the first option of the select box below? I know I<br>
41
+ also have an issue given that I'm translating from an XML representation<br>
42
+ to a Ruby Watir call, and I'm probably getting a nil back from REXML<br>
43
+ when I ask for the value of an attribute that has nothing between the<br>
44
+ quotes....<br>
45
+ <br>
46
+ <select class="body" name="s_interest" id="s_interest">
47
+ <option value="" selected="Y"></option>
48
+ <option value="-1">Yes</option>
49
+ <option value="0">No</option>
50
+ </select>
51
+ <br>
52
+ <br>
53
+ </body>
54
+ </html>