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,44 +1,44 @@
1
- module FireWatir
2
- #
3
- # Description:
4
- # Base class containing items that are common between select list, text field, button, hidden, file field classes.
5
- #
6
- class InputElement < Element
7
- attr_accessor :element_name
8
- #
9
- # Description:
10
- # Locate the element on the page. Element can be a select list, text field, button, hidden, file field.
11
- #
12
- def locate
13
- case @how
14
- when :jssh_name
15
- @element_name = @what
16
- when :xpath
17
- @element_name = element_by_xpath(@container, @what)
18
- else
19
- if(self.class::INPUT_TYPES.include?("select-one"))
20
- @element_name = locate_tagged_element("select", @how, @what, self.class::INPUT_TYPES)
21
- else
22
- @element_name = locate_tagged_element("input", @how, @what, self.class::INPUT_TYPES)
23
- end
24
- end
25
- @o = self
26
- end
27
- #
28
- # Description:
29
- # Initializes the instance of element.
30
- #
31
- # Input:
32
- # - how - Attribute to identify the element.
33
- # - what - Value of that attribute.
34
- #
35
- def initialize(container, how, what)
36
- @how = how
37
- @what = what
38
- @container = container
39
- @element_name = ""
40
- #super(nil)
41
- end
42
-
43
- end # FireWatir
44
- end # InputElement
1
+ module FireWatir
2
+ #
3
+ # Description:
4
+ # Base class containing items that are common between select list, text field, button, hidden, file field classes.
5
+ #
6
+ class InputElement < Element
7
+ attr_accessor :element_name
8
+ #
9
+ # Description:
10
+ # Locate the element on the page. Element can be a select list, text field, button, hidden, file field.
11
+ #
12
+ def locate
13
+ case @how
14
+ when :jssh_name
15
+ @element_name = @what
16
+ when :xpath
17
+ @element_name = element_by_xpath(@container, @what)
18
+ else
19
+ if(self.class::INPUT_TYPES.include?("select-one"))
20
+ @element_name = locate_tagged_element("select", @how, @what, self.class::INPUT_TYPES)
21
+ else
22
+ @element_name = locate_tagged_element("input", @how, @what, self.class::INPUT_TYPES)
23
+ end
24
+ end
25
+ @o = self
26
+ end
27
+ #
28
+ # Description:
29
+ # Initializes the instance of element.
30
+ #
31
+ # Input:
32
+ # - how - Attribute to identify the element.
33
+ # - what - Value of that attribute.
34
+ #
35
+ def initialize(container, how, what)
36
+ @how = how
37
+ @what = what
38
+ @container = container
39
+ @element_name = ""
40
+ #super(nil)
41
+ end
42
+
43
+ end # FireWatir
44
+ end # InputElement
@@ -1,76 +1,76 @@
1
- module FireWatir
2
- #
3
- # Description:
4
- # Class for Link element.
5
- #
6
- class Link < Element
7
- attr_accessor :element_name
8
- TAG = 'A'
9
- #
10
- # Description:
11
- # Initializes the instance of link element.
12
- #
13
- # Input:
14
- # - how - Attribute to identify the link element.
15
- # - what - Value of that attribute.
16
- #
17
- def initialize(container, how, what)
18
- @how = how
19
- @what = what
20
- @container = container
21
- end
22
-
23
- #
24
- # Description:
25
- # Locate the link element on the page.
26
- #
27
- def locate
28
- case @how
29
- when :jssh_name
30
- @element_name = @what
31
- when :xpath
32
- @element_name = element_by_xpath(@container, @what)
33
- else
34
- @element_name = locate_tagged_element('A', @how, @what)
35
- end
36
- @o = self
37
- end
38
-
39
- #TODO: if an image is used as part of the link, this will return true
40
- #def link_has_image
41
- # assert_exists
42
- # return true if @o.getElementsByTagName("IMG").length > 0
43
- # return false
44
- #end
45
-
46
- #TODO: this method returns the src of an image, if an image is used as part of the link
47
- #def src # BUG?
48
- # assert_exists
49
- # if @o.getElementsByTagName("IMG").length > 0
50
- # return @o.getElementsByTagName("IMG")[0.to_s].src
51
- # else
52
- # return ""
53
- # end
54
- #end
55
-
56
- #
57
- # Description:
58
- # Used to populate the properties in to_s method.
59
- #
60
- #def link_string_creator
61
- # n = []
62
- # n << "href:".ljust(TO_S_SIZE) + self.href
63
- # n << "inner text:".ljust(TO_S_SIZE) + self.text
64
- # n << "img src:".ljust(TO_S_SIZE) + self.src if self.link_has_image
65
- # return n
66
- # end
67
-
68
- # returns a textual description of the link
69
-
70
- def to_s
71
- assert_exists
72
- super({"href" => "href","inner text" => "text"})
73
- end
74
-
75
- end # Link
76
- end # FireWatir
1
+ module FireWatir
2
+ #
3
+ # Description:
4
+ # Class for Link element.
5
+ #
6
+ class Link < Element
7
+ attr_accessor :element_name
8
+ TAG = 'A'
9
+ #
10
+ # Description:
11
+ # Initializes the instance of link element.
12
+ #
13
+ # Input:
14
+ # - how - Attribute to identify the link element.
15
+ # - what - Value of that attribute.
16
+ #
17
+ def initialize(container, how, what)
18
+ @how = how
19
+ @what = what
20
+ @container = container
21
+ end
22
+
23
+ #
24
+ # Description:
25
+ # Locate the link element on the page.
26
+ #
27
+ def locate
28
+ case @how
29
+ when :jssh_name
30
+ @element_name = @what
31
+ when :xpath
32
+ @element_name = element_by_xpath(@container, @what)
33
+ else
34
+ @element_name = locate_tagged_element('A', @how, @what)
35
+ end
36
+ @o = self
37
+ end
38
+
39
+ #TODO: if an image is used as part of the link, this will return true
40
+ #def link_has_image
41
+ # assert_exists
42
+ # return true if @o.getElementsByTagName("IMG").length > 0
43
+ # return false
44
+ #end
45
+
46
+ #TODO: this method returns the src of an image, if an image is used as part of the link
47
+ #def src # BUG?
48
+ # assert_exists
49
+ # if @o.getElementsByTagName("IMG").length > 0
50
+ # return @o.getElementsByTagName("IMG")[0.to_s].src
51
+ # else
52
+ # return ""
53
+ # end
54
+ #end
55
+
56
+ #
57
+ # Description:
58
+ # Used to populate the properties in to_s method.
59
+ #
60
+ #def link_string_creator
61
+ # n = []
62
+ # n << "href:".ljust(TO_S_SIZE) + self.href
63
+ # n << "inner text:".ljust(TO_S_SIZE) + self.text
64
+ # n << "img src:".ljust(TO_S_SIZE) + self.src if self.link_has_image
65
+ # return n
66
+ # end
67
+
68
+ # returns a textual description of the link
69
+
70
+ def to_s
71
+ assert_exists
72
+ super({"href" => "href","inner text" => "text"})
73
+ end
74
+
75
+ end # Link
76
+ end # FireWatir
@@ -1,53 +1,53 @@
1
- module FireWatir
2
-
3
- # Base class containing items that are common between the span, div, label, p and pre classes.
4
- class NonControlElement < Element
5
- def self.inherited subclass
6
- class_name = subclass.to_s.demodulize
7
- method_name = class_name.underscore
8
- FireWatir::Container.module_eval "def #{method_name}(how, what=nil)
9
- locate if respond_to?(:locate)
10
- return #{class_name}.new(self, how, what); end"
11
- end
12
-
13
- attr_accessor :element_name
14
-
15
- #
16
- # Description:
17
- # Locate the element on the page. Element can be a span, div, label, p or pre HTML tag.
18
- #
19
- def locate
20
- case @how
21
- when :jssh_name
22
- @element_name = @what
23
- when :xpath
24
- @element_name = element_by_xpath(@container, @what)
25
- else
26
- @element_name = locate_tagged_element(self.class::TAG, @how, @what)
27
- end
28
- @o = self
29
- end
30
-
31
- # - how - Attribute to identify the element.
32
- # - what - Value of that attribute.
33
- def initialize(container, how, what)
34
- #@element = Element.new(nil)
35
- @how = how
36
- @what = what
37
- @container = container
38
- @o = nil
39
- end
40
-
41
- # Returns a string of properties of the object.
42
- def to_s(attributes = nil)
43
- assert_exists
44
- hash_properties = {"text"=>"innerHTML"}
45
- hash_properties.update(attributes) if attributes != nil
46
- r = super(hash_properties)
47
- #r = string_creator
48
- #r += span_div_string_creator
49
- return r.join("\n")
50
- end
51
-
52
- end # NonControlElement
53
- end # FireWatir
1
+ module FireWatir
2
+
3
+ # Base class containing items that are common between the span, div, label, p and pre classes.
4
+ class NonControlElement < Element
5
+ def self.inherited subclass
6
+ class_name = subclass.to_s.demodulize
7
+ method_name = class_name.underscore
8
+ FireWatir::Container.module_eval "def #{method_name}(how, what=nil)
9
+ locate if respond_to?(:locate)
10
+ return #{class_name}.new(self, how, what); end"
11
+ end
12
+
13
+ attr_accessor :element_name
14
+
15
+ #
16
+ # Description:
17
+ # Locate the element on the page. Element can be a span, div, label, p or pre HTML tag.
18
+ #
19
+ def locate
20
+ case @how
21
+ when :jssh_name
22
+ @element_name = @what
23
+ when :xpath
24
+ @element_name = element_by_xpath(@container, @what)
25
+ else
26
+ @element_name = locate_tagged_element(self.class::TAG, @how, @what)
27
+ end
28
+ @o = self
29
+ end
30
+
31
+ # - how - Attribute to identify the element.
32
+ # - what - Value of that attribute.
33
+ def initialize(container, how, what)
34
+ #@element = Element.new(nil)
35
+ @how = how
36
+ @what = what
37
+ @container = container
38
+ @o = nil
39
+ end
40
+
41
+ # Returns a string of properties of the object.
42
+ def to_s(attributes = nil)
43
+ assert_exists
44
+ hash_properties = {"text"=>"innerHTML"}
45
+ hash_properties.update(attributes) if attributes != nil
46
+ r = super(hash_properties)
47
+ #r = string_creator
48
+ #r += span_div_string_creator
49
+ return r.join("\n")
50
+ end
51
+
52
+ end # NonControlElement
53
+ end # FireWatir
@@ -1,108 +1,108 @@
1
- module FireWatir
2
- class Pre < NonControlElement
3
- TAG = 'PRE'
4
- end
5
-
6
- class P < NonControlElement
7
- TAG = 'P'
8
- end
9
-
10
- class Div < NonControlElement
11
- TAG = 'DIV'
12
- end
13
-
14
- class Span < NonControlElement
15
- TAG = 'SPAN'
16
- end
17
-
18
- class Strong < NonControlElement
19
- TAG = 'STRONG'
20
- end
21
-
22
- class Label < NonControlElement
23
- TAG = 'LABEL'
24
-
25
- #
26
- # Description:
27
- # Used to populate the properties in the to_s method.
28
- #
29
- #def label_string_creator
30
- # n = []
31
- # n << "for:".ljust(TO_S_SIZE) + self.for
32
- # n << "inner text:".ljust(TO_S_SIZE) + self.text
33
- # return n
34
- #end
35
- #private :label_string_creator
36
-
37
- #
38
- # Description:
39
- # Creates string of properties of the object.
40
- #
41
- def to_s
42
- assert_exists
43
- super({"for" => "htmlFor","text" => "innerHTML"})
44
- # r=r + label_string_creator
45
- end
46
- end
47
-
48
- class Ul < NonControlElement
49
- TAG = 'UL'
50
- end
51
-
52
- class Li < NonControlElement
53
- TAG = 'LI'
54
- end
55
-
56
- class Dl < NonControlElement
57
- TAG = 'DL'
58
- end
59
-
60
- class Dt < NonControlElement
61
- TAG = 'DT'
62
- end
63
-
64
- class Dd < NonControlElement
65
- TAG = 'DD'
66
- end
67
-
68
- class H1 < NonControlElement
69
- TAG = 'H1'
70
- end
71
-
72
- class H2 < NonControlElement
73
- TAG = 'H2'
74
- end
75
-
76
- class H3 < NonControlElement
77
- TAG = 'H3'
78
- end
79
-
80
- class H4 < NonControlElement
81
- TAG = 'H4'
82
- end
83
-
84
- class H5 < NonControlElement
85
- TAG = 'H5'
86
- end
87
-
88
- class H6 < NonControlElement
89
- TAG = 'H6'
90
- end
91
-
92
- class Map < NonControlElement
93
- TAG = 'MAP'
94
- end
95
-
96
- class Area < NonControlElement
97
- TAG = 'AREA'
98
- end
99
-
100
- class Body < NonControlElement
101
- TAG = 'TBODY'
102
- end
103
-
104
- class Em < NonControlElement
105
- TAG = 'EM'
106
- end
107
-
108
- end # FireWatir
1
+ module FireWatir
2
+ class Pre < NonControlElement
3
+ TAG = 'PRE'
4
+ end
5
+
6
+ class P < NonControlElement
7
+ TAG = 'P'
8
+ end
9
+
10
+ class Div < NonControlElement
11
+ TAG = 'DIV'
12
+ end
13
+
14
+ class Span < NonControlElement
15
+ TAG = 'SPAN'
16
+ end
17
+
18
+ class Strong < NonControlElement
19
+ TAG = 'STRONG'
20
+ end
21
+
22
+ class Label < NonControlElement
23
+ TAG = 'LABEL'
24
+
25
+ #
26
+ # Description:
27
+ # Used to populate the properties in the to_s method.
28
+ #
29
+ #def label_string_creator
30
+ # n = []
31
+ # n << "for:".ljust(TO_S_SIZE) + self.for
32
+ # n << "inner text:".ljust(TO_S_SIZE) + self.text
33
+ # return n
34
+ #end
35
+ #private :label_string_creator
36
+
37
+ #
38
+ # Description:
39
+ # Creates string of properties of the object.
40
+ #
41
+ def to_s
42
+ assert_exists
43
+ super({"for" => "htmlFor","text" => "innerHTML"})
44
+ # r=r + label_string_creator
45
+ end
46
+ end
47
+
48
+ class Ul < NonControlElement
49
+ TAG = 'UL'
50
+ end
51
+
52
+ class Li < NonControlElement
53
+ TAG = 'LI'
54
+ end
55
+
56
+ class Dl < NonControlElement
57
+ TAG = 'DL'
58
+ end
59
+
60
+ class Dt < NonControlElement
61
+ TAG = 'DT'
62
+ end
63
+
64
+ class Dd < NonControlElement
65
+ TAG = 'DD'
66
+ end
67
+
68
+ class H1 < NonControlElement
69
+ TAG = 'H1'
70
+ end
71
+
72
+ class H2 < NonControlElement
73
+ TAG = 'H2'
74
+ end
75
+
76
+ class H3 < NonControlElement
77
+ TAG = 'H3'
78
+ end
79
+
80
+ class H4 < NonControlElement
81
+ TAG = 'H4'
82
+ end
83
+
84
+ class H5 < NonControlElement
85
+ TAG = 'H5'
86
+ end
87
+
88
+ class H6 < NonControlElement
89
+ TAG = 'H6'
90
+ end
91
+
92
+ class Map < NonControlElement
93
+ TAG = 'MAP'
94
+ end
95
+
96
+ class Area < NonControlElement
97
+ TAG = 'AREA'
98
+ end
99
+
100
+ class Body < NonControlElement
101
+ TAG = 'TBODY'
102
+ end
103
+
104
+ class Em < NonControlElement
105
+ TAG = 'EM'
106
+ end
107
+
108
+ end # FireWatir