firewatir 1.6.5 → 1.6.6.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. data/CHANGES +461 -0
  2. data/LICENSE +31 -31
  3. data/README.rdoc +112 -0
  4. data/VERSION +1 -0
  5. data/lib/firewatir.rb +41 -40
  6. data/lib/firewatir/container.rb +491 -491
  7. data/lib/firewatir/document.rb +239 -239
  8. data/lib/firewatir/element.rb +1364 -1364
  9. data/lib/firewatir/element_collections.rb +314 -314
  10. data/lib/firewatir/elements/button.rb +15 -15
  11. data/lib/firewatir/elements/file_field.rb +29 -29
  12. data/lib/firewatir/elements/form.rb +40 -40
  13. data/lib/firewatir/elements/frame.rb +55 -55
  14. data/lib/firewatir/elements/hidden.rb +56 -56
  15. data/lib/firewatir/elements/image.rb +139 -139
  16. data/lib/firewatir/elements/input_element.rb +44 -44
  17. data/lib/firewatir/elements/link.rb +76 -76
  18. data/lib/firewatir/elements/non_control_element.rb +53 -53
  19. data/lib/firewatir/elements/non_control_elements.rb +108 -108
  20. data/lib/firewatir/elements/not_used.rb +278 -278
  21. data/lib/firewatir/elements/option.rb +130 -130
  22. data/lib/firewatir/elements/radio_check_common.rb +163 -163
  23. data/lib/firewatir/elements/select_list.rb +188 -188
  24. data/lib/firewatir/elements/table.rb +218 -218
  25. data/lib/firewatir/elements/table_cell.rb +54 -54
  26. data/lib/firewatir/elements/table_row.rb +100 -100
  27. data/lib/firewatir/elements/text_field.rb +218 -218
  28. data/lib/firewatir/exceptions.rb +10 -10
  29. data/lib/firewatir/firefox.rb +984 -1040
  30. data/lib/firewatir/jssh_socket.rb +100 -100
  31. data/lib/firewatir/winClicker.rb +122 -122
  32. data/lib/firewatir/x11.rb +192 -192
  33. data/rakefile.rb +15 -0
  34. data/unittests/attach_to_new_window_test.rb +49 -49
  35. data/unittests/bug_fixes_test.rb +195 -195
  36. data/unittests/buttons_xpath_test.rb +88 -88
  37. data/unittests/checkbox_test.rb +158 -158
  38. data/unittests/checkbox_xpath_test.rb +107 -107
  39. data/unittests/div_test.rb +275 -275
  40. data/unittests/ff_test.rb +47 -0
  41. data/unittests/filefield_test.rb +49 -49
  42. data/unittests/filefield_xpath_test.rb +35 -35
  43. data/unittests/form_test.rb +296 -296
  44. data/unittests/frame_test.rb +159 -159
  45. data/unittests/hidden_test.rb +85 -85
  46. data/unittests/hidden_xpath_test.rb +72 -72
  47. data/unittests/html/JavascriptClick.html +42 -42
  48. data/unittests/html/blankpage.html +11 -11
  49. data/unittests/html/buttons1.html +61 -61
  50. data/unittests/html/checkboxes1.html +70 -70
  51. data/unittests/html/complex_table.html +36 -36
  52. data/unittests/html/cssTest.html +42 -42
  53. data/unittests/html/div.html +72 -72
  54. data/unittests/html/div_xml.html +20 -20
  55. data/unittests/html/fileupload.html +45 -45
  56. data/unittests/html/formTest1.html +38 -38
  57. data/unittests/html/forms2.html +45 -45
  58. data/unittests/html/forms3.html +132 -132
  59. data/unittests/html/forms4.html +27 -27
  60. data/unittests/html/frame_buttons.html +3 -3
  61. data/unittests/html/frame_links.html +3 -3
  62. data/unittests/html/frame_multi.html +4 -4
  63. data/unittests/html/iframeTest.html +14 -14
  64. data/unittests/html/iframeTest1.html +13 -13
  65. data/unittests/html/iframeTest2.html +5 -5
  66. data/unittests/html/images1.html +66 -66
  67. data/unittests/html/javascriptevents.html +35 -35
  68. data/unittests/html/link_pass.html +10 -10
  69. data/unittests/html/links1.html +42 -42
  70. data/unittests/html/links2.html +10 -10
  71. data/unittests/html/modal_dialog.html +8 -8
  72. data/unittests/html/modal_dialog_launcher.html +11 -11
  73. data/unittests/html/nestedFrames.html +6 -6
  74. data/unittests/html/new_browser.html +17 -17
  75. data/unittests/html/new_browser_popup.html +7 -7
  76. data/unittests/html/pass.html +9 -9
  77. data/unittests/html/popups1.html +60 -60
  78. data/unittests/html/pre.html +27 -27
  79. data/unittests/html/radioButtons1.html +70 -70
  80. data/unittests/html/redirect.html +10 -10
  81. data/unittests/html/redirect1.html +8 -8
  82. data/unittests/html/redirect2.html +8 -8
  83. data/unittests/html/redirect3.html +8 -8
  84. data/unittests/html/select_tealeaf.html +54 -54
  85. data/unittests/html/selectboxes1.html +55 -55
  86. data/unittests/html/simple_table.html +26 -26
  87. data/unittests/html/simple_table_buttons.html +104 -104
  88. data/unittests/html/simple_table_columns.html +74 -74
  89. data/unittests/html/table1.html +165 -165
  90. data/unittests/html/tableCell_using_xpath.html +19 -19
  91. data/unittests/html/textarea.html +30 -30
  92. data/unittests/html/textfields1.html +62 -62
  93. data/unittests/html/textsearch.html +44 -44
  94. data/unittests/images_test.rb +198 -198
  95. data/unittests/images_xpath_test.rb +118 -118
  96. data/unittests/javascript_test.rb +75 -75
  97. data/unittests/links_test.rb +231 -231
  98. data/unittests/links_xpath_test.rb +79 -79
  99. data/unittests/mozilla_all_tests.rb +7 -7
  100. data/unittests/pre_test.rb +75 -75
  101. data/unittests/radios_test.rb +166 -166
  102. data/unittests/radios_xpath_test.rb +101 -101
  103. data/unittests/redirect_test.rb +41 -41
  104. data/unittests/selectbox_test.rb +142 -142
  105. data/unittests/selectbox_xpath_test.rb +129 -129
  106. data/unittests/setup.rb +29 -29
  107. data/unittests/table_test.rb +385 -385
  108. data/unittests/table_xpath_test.rb +185 -185
  109. data/unittests/textfields_test.rb +234 -234
  110. data/unittests/textfields_xpath_test.rb +113 -113
  111. metadata +51 -19
  112. data/lib/firewatir/version.rb +0 -5
@@ -1,131 +1,131 @@
1
- module FireWatir
2
- #
3
- # Description:
4
- # Class for Option element.
5
- #
6
- class Option < InputElement
7
- #
8
- # Description:
9
- # Initializes the instance of option object.
10
- #
11
- # Input:
12
- # - select_list - instance of select list element.
13
- # - attribute - Attribute to identify the option.
14
- # - value - Value of that attribute.
15
- #
16
- def initialize (select_list, attribute, value)
17
- @select_list = @container = select_list
18
- @how = attribute
19
- @what = value
20
- @option = nil
21
- @element_name = ""
22
-
23
- unless [:text, :value, :jssh_name].include? attribute
24
- raise MissingWayOfFindingObjectException,
25
- "Option does not support attribute #{@how}"
26
- end
27
- #puts @select_list.o.length
28
- #puts "what is : #{@what}, how is #{@how}, list name is : #{@select_list.element_name}"
29
- if(attribute == :jssh_name)
30
- @element_name = @what
31
- @option = self
32
- else
33
- @select_list.o.each do |option| # items in the list
34
- #puts "option is : #{option}"
35
- if(attribute == :value)
36
- match_value = option.value
37
- else
38
- match_value = option.text
39
- end
40
- #puts "value is #{match_value}"
41
- if value.matches( match_value) #option.invoke(attribute))
42
- @option = option
43
- @element_name = option.element_name
44
- break
45
- end
46
- end
47
- end
48
- end
49
-
50
- #
51
- # Description:
52
- # Checks if option exists or not.
53
- #
54
- def assert_exists
55
- unless @option
56
- raise UnknownObjectException,
57
- "Unable to locate an option using #{@how} and #{@what}"
58
- end
59
- end
60
- private :assert_exists
61
-
62
- #
63
- # Description:
64
- # Selects the option.
65
- #
66
- def select
67
- assert_exists
68
- if(@how == :text)
69
- @select_list.select(@what)
70
- elsif(@how == :value)
71
- @select_list.select_value(@what)
72
- end
73
- end
74
-
75
- #
76
- # Description:
77
- # Gets the class name of the option.
78
- #
79
- # Output:
80
- # Class name of the option.
81
- #
82
- def class_name
83
- assert_exists
84
- jssh_socket.send("#{element_object}.className;\n", 0)
85
- return read_socket()
86
- end
87
-
88
- #
89
- # Description:
90
- # Gets the text of the option.
91
- #
92
- # Output:
93
- # Text of the option.
94
- #
95
- def text
96
- assert_exists
97
- jssh_socket.send("#{element_object}.text;\n", 0)
98
- return read_socket()
99
- end
100
-
101
- #
102
- # Description:
103
- # Gets the value of the option.
104
- #
105
- # Output:
106
- # Value of the option.
107
- #
108
- def value
109
- assert_exists
110
- jssh_socket.send("#{element_object}.value;\n", 0)
111
- return read_socket()
112
- end
113
-
114
- #
115
- # Description:
116
- # Gets the status of the option; whether it is selected or not.
117
- #
118
- # Output:
119
- # True if option is selected, false otherwise.
120
- #
121
- def selected
122
- assert_exists
123
- jssh_socket.send("#{element_object}.selected;\n", 0)
124
- value = read_socket()
125
- return true if value == "true"
126
- return false if value == "false"
127
- end
128
-
129
-
130
- end # Option
1
+ module FireWatir
2
+ #
3
+ # Description:
4
+ # Class for Option element.
5
+ #
6
+ class Option < InputElement
7
+ #
8
+ # Description:
9
+ # Initializes the instance of option object.
10
+ #
11
+ # Input:
12
+ # - select_list - instance of select list element.
13
+ # - attribute - Attribute to identify the option.
14
+ # - value - Value of that attribute.
15
+ #
16
+ def initialize (select_list, attribute, value)
17
+ @select_list = @container = select_list
18
+ @how = attribute
19
+ @what = value
20
+ @option = nil
21
+ @element_name = ""
22
+
23
+ unless [:text, :value, :jssh_name].include? attribute
24
+ raise MissingWayOfFindingObjectException,
25
+ "Option does not support attribute #{@how}"
26
+ end
27
+ #puts @select_list.o.length
28
+ #puts "what is : #{@what}, how is #{@how}, list name is : #{@select_list.element_name}"
29
+ if(attribute == :jssh_name)
30
+ @element_name = @what
31
+ @option = self
32
+ else
33
+ @select_list.o.each do |option| # items in the list
34
+ #puts "option is : #{option}"
35
+ if(attribute == :value)
36
+ match_value = option.value
37
+ else
38
+ match_value = option.text
39
+ end
40
+ #puts "value is #{match_value}"
41
+ if value.matches( match_value) #option.invoke(attribute))
42
+ @option = option
43
+ @element_name = option.element_name
44
+ break
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ #
51
+ # Description:
52
+ # Checks if option exists or not.
53
+ #
54
+ def assert_exists
55
+ unless @option
56
+ raise UnknownObjectException,
57
+ "Unable to locate an option using #{@how} and #{@what}"
58
+ end
59
+ end
60
+ private :assert_exists
61
+
62
+ #
63
+ # Description:
64
+ # Selects the option.
65
+ #
66
+ def select
67
+ assert_exists
68
+ if(@how == :text)
69
+ @select_list.select(@what)
70
+ elsif(@how == :value)
71
+ @select_list.select_value(@what)
72
+ end
73
+ end
74
+
75
+ #
76
+ # Description:
77
+ # Gets the class name of the option.
78
+ #
79
+ # Output:
80
+ # Class name of the option.
81
+ #
82
+ def class_name
83
+ assert_exists
84
+ jssh_socket.send("#{element_object}.className;\n", 0)
85
+ return read_socket()
86
+ end
87
+
88
+ #
89
+ # Description:
90
+ # Gets the text of the option.
91
+ #
92
+ # Output:
93
+ # Text of the option.
94
+ #
95
+ def text
96
+ assert_exists
97
+ jssh_socket.send("#{element_object}.text;\n", 0)
98
+ return read_socket()
99
+ end
100
+
101
+ #
102
+ # Description:
103
+ # Gets the value of the option.
104
+ #
105
+ # Output:
106
+ # Value of the option.
107
+ #
108
+ def value
109
+ assert_exists
110
+ jssh_socket.send("#{element_object}.value;\n", 0)
111
+ return read_socket()
112
+ end
113
+
114
+ #
115
+ # Description:
116
+ # Gets the status of the option; whether it is selected or not.
117
+ #
118
+ # Output:
119
+ # True if option is selected, false otherwise.
120
+ #
121
+ def selected
122
+ assert_exists
123
+ jssh_socket.send("#{element_object}.selected;\n", 0)
124
+ value = read_socket()
125
+ return true if value == "true"
126
+ return false if value == "false"
127
+ end
128
+
129
+
130
+ end # Option
131
131
  end # FireWatir
@@ -1,163 +1,163 @@
1
- module FireWatir
2
- #
3
- # Description:
4
- # Base class for checkbox and radio button elements.
5
- #
6
- class RadioCheckCommon < Element
7
- attr_accessor :element_name
8
- #
9
- # Description:
10
- # Initializes the instance of element object. Element can be checkbox or radio button.
11
- #
12
- # Input:
13
- # - how - Attribute to identify the element.
14
- # - what - Value of that attribute.
15
- # - value - value of the element.
16
- #
17
- def initialize(container, how, what, value = nil)
18
- @how = how
19
- @what = what
20
- @value = value
21
- @container = container
22
- end
23
-
24
- #
25
- # Description:
26
- # Locate the element on the page. Element can be a checkbox or radio button.
27
- #
28
- def locate
29
- case @how
30
- when :jssh_name
31
- @element_name = @what
32
- when :xpath
33
- @element_name = element_by_xpath(@container, @what)
34
- else
35
- @element_name = locate_tagged_element("input", @how, @what, @type, @value)
36
- end
37
- @o = self
38
- end
39
-
40
- #
41
- # Description:
42
- # Checks if element i.e. radio button or check box is checked or not.
43
- #
44
- # Output:
45
- # True if element is checked, false otherwise.
46
- #
47
- def set?
48
- assert_exists
49
- return @o.checked
50
- end
51
- alias getState set?
52
- alias checked? set?
53
- alias isSet? set?
54
-
55
- #
56
- # Description:
57
- # Unchecks the radio button or check box element.
58
- # Raises ObjectDisabledException exception if element is disabled.
59
- #
60
- def clear
61
- assert_exists
62
- assert_enabled
63
- #highlight(:set)
64
- set_clear_item(false)
65
- #highlight(:clear)
66
- end
67
-
68
- #
69
- # Description:
70
- # Checks the radio button or check box element.
71
- # Raises ObjectDisabledException exception if element is disabled.
72
- #
73
- def set
74
- assert_exists
75
- assert_enabled
76
- #highlight(:set)
77
- set_clear_item(true)
78
- #highlight(:clear)
79
- end
80
-
81
- #
82
- # Description:
83
- # Used by clear and set method to uncheck and check radio button and checkbox element respectively.
84
- #
85
- def set_clear_item(set)
86
- @o.fire_event("onclick")
87
- @container.wait
88
- end
89
- private :set_clear_item
90
-
91
- end # RadioCheckCommon
92
-
93
- #
94
- # Description:
95
- # Class for RadioButton element.
96
- #
97
- class Radio < RadioCheckCommon
98
- def initialize *args
99
- super
100
- @type = ["radio"]
101
- end
102
-
103
- def clear
104
- assert_exists
105
- assert_enabled
106
- #higlight(:set)
107
- @o.checked = false
108
- #highlight(:clear)
109
- end
110
-
111
- end # Radio
112
-
113
- #
114
- # Description:
115
- # Class for Checkbox element.
116
- #
117
- class CheckBox < RadioCheckCommon
118
- def initialize *args
119
- super
120
- @type = ["checkbox"]
121
- end
122
-
123
- #
124
- # Description:
125
- # Checks or unchecks the checkbox. If no value is supplied it will check the checkbox.
126
- # Raises ObjectDisabledException exception if the object is disabled
127
- #
128
- # Input:
129
- # - set_or_clear - Parameter indicated whether to check or uncheck the checkbox.
130
- # True to check the check box, false for unchecking the checkbox.
131
- #
132
- def set( set_or_clear=true )
133
- assert_exists
134
- assert_enabled
135
- highlight(:set)
136
-
137
- if set_or_clear == true
138
- if @o.checked == false
139
- set_clear_item( true )
140
- end
141
- else
142
- self.clear
143
- end
144
- highlight(:clear )
145
- end
146
-
147
- #
148
- # Description:
149
- # Unchecks the checkbox.
150
- # Raises ObjectDisabledException exception if the object is disabled
151
- #
152
- def clear
153
- assert_exists
154
- assert_enabled
155
- highlight( :set)
156
- if @o.checked == true
157
- set_clear_item( false )
158
- end
159
- highlight( :clear)
160
- end
161
-
162
- end # CheckBox
163
- end # FireWatir
1
+ module FireWatir
2
+ #
3
+ # Description:
4
+ # Base class for checkbox and radio button elements.
5
+ #
6
+ class RadioCheckCommon < Element
7
+ attr_accessor :element_name
8
+ #
9
+ # Description:
10
+ # Initializes the instance of element object. Element can be checkbox or radio button.
11
+ #
12
+ # Input:
13
+ # - how - Attribute to identify the element.
14
+ # - what - Value of that attribute.
15
+ # - value - value of the element.
16
+ #
17
+ def initialize(container, how, what, value = nil)
18
+ @how = how
19
+ @what = what
20
+ @value = value
21
+ @container = container
22
+ end
23
+
24
+ #
25
+ # Description:
26
+ # Locate the element on the page. Element can be a checkbox or radio button.
27
+ #
28
+ def locate
29
+ case @how
30
+ when :jssh_name
31
+ @element_name = @what
32
+ when :xpath
33
+ @element_name = element_by_xpath(@container, @what)
34
+ else
35
+ @element_name = locate_tagged_element("input", @how, @what, @type, @value)
36
+ end
37
+ @o = self
38
+ end
39
+
40
+ #
41
+ # Description:
42
+ # Checks if element i.e. radio button or check box is checked or not.
43
+ #
44
+ # Output:
45
+ # True if element is checked, false otherwise.
46
+ #
47
+ def set?
48
+ assert_exists
49
+ return @o.checked
50
+ end
51
+ alias getState set?
52
+ alias checked? set?
53
+ alias isSet? set?
54
+
55
+ #
56
+ # Description:
57
+ # Unchecks the radio button or check box element.
58
+ # Raises ObjectDisabledException exception if element is disabled.
59
+ #
60
+ def clear
61
+ assert_exists
62
+ assert_enabled
63
+ #highlight(:set)
64
+ set_clear_item(false)
65
+ #highlight(:clear)
66
+ end
67
+
68
+ #
69
+ # Description:
70
+ # Checks the radio button or check box element.
71
+ # Raises ObjectDisabledException exception if element is disabled.
72
+ #
73
+ def set
74
+ assert_exists
75
+ assert_enabled
76
+ #highlight(:set)
77
+ set_clear_item(true)
78
+ #highlight(:clear)
79
+ end
80
+
81
+ #
82
+ # Description:
83
+ # Used by clear and set method to uncheck and check radio button and checkbox element respectively.
84
+ #
85
+ def set_clear_item(set)
86
+ @o.fire_event("onclick")
87
+ @container.wait
88
+ end
89
+ private :set_clear_item
90
+
91
+ end # RadioCheckCommon
92
+
93
+ #
94
+ # Description:
95
+ # Class for RadioButton element.
96
+ #
97
+ class Radio < RadioCheckCommon
98
+ def initialize *args
99
+ super
100
+ @type = ["radio"]
101
+ end
102
+
103
+ def clear
104
+ assert_exists
105
+ assert_enabled
106
+ #higlight(:set)
107
+ @o.checked = false
108
+ #highlight(:clear)
109
+ end
110
+
111
+ end # Radio
112
+
113
+ #
114
+ # Description:
115
+ # Class for Checkbox element.
116
+ #
117
+ class CheckBox < RadioCheckCommon
118
+ def initialize *args
119
+ super
120
+ @type = ["checkbox"]
121
+ end
122
+
123
+ #
124
+ # Description:
125
+ # Checks or unchecks the checkbox. If no value is supplied it will check the checkbox.
126
+ # Raises ObjectDisabledException exception if the object is disabled
127
+ #
128
+ # Input:
129
+ # - set_or_clear - Parameter indicated whether to check or uncheck the checkbox.
130
+ # True to check the check box, false for unchecking the checkbox.
131
+ #
132
+ def set( set_or_clear=true )
133
+ assert_exists
134
+ assert_enabled
135
+ highlight(:set)
136
+
137
+ if set_or_clear == true
138
+ if @o.checked == false
139
+ set_clear_item( true )
140
+ end
141
+ else
142
+ self.clear
143
+ end
144
+ highlight(:clear )
145
+ end
146
+
147
+ #
148
+ # Description:
149
+ # Unchecks the checkbox.
150
+ # Raises ObjectDisabledException exception if the object is disabled
151
+ #
152
+ def clear
153
+ assert_exists
154
+ assert_enabled
155
+ highlight( :set)
156
+ if @o.checked == true
157
+ set_clear_item( false )
158
+ end
159
+ highlight( :clear)
160
+ end
161
+
162
+ end # CheckBox
163
+ end # FireWatir