watir-webdriver 0.0.1.dev5 → 0.0.1.dev6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. data/Rakefile +13 -19
  2. data/VERSION +1 -1
  3. data/lib/watir-webdriver.rb +3 -1
  4. data/lib/watir-webdriver/base_element.rb +33 -27
  5. data/lib/watir-webdriver/browser.rb +2 -6
  6. data/lib/watir-webdriver/elements/font.rb +12 -0
  7. data/lib/watir-webdriver/elements/generated.rb +1027 -622
  8. data/lib/watir-webdriver/elements/select_list.rb +3 -3
  9. data/lib/watir-webdriver/locators/element_locator.rb +2 -2
  10. data/lib/watir-webdriver/xpath_support.rb +2 -2
  11. data/support/html5/html5.idl +942 -483
  12. data/support/html5/old/html5.idl +962 -0
  13. data/support/html5/{html5_extras.idl → old/html5_extras.idl} +0 -2
  14. data/support/html5/watir_visitor.rb +23 -19
  15. metadata +74 -100
  16. data/spec/watirspec/area_spec.rb +0 -78
  17. data/spec/watirspec/areas_spec.rb +0 -31
  18. data/spec/watirspec/browser_spec.rb +0 -274
  19. data/spec/watirspec/button_spec.rb +0 -242
  20. data/spec/watirspec/buttons_spec.rb +0 -48
  21. data/spec/watirspec/checkbox_spec.rb +0 -272
  22. data/spec/watirspec/checkboxes_spec.rb +0 -32
  23. data/spec/watirspec/dd_spec.rb +0 -123
  24. data/spec/watirspec/dds_spec.rb +0 -31
  25. data/spec/watirspec/div_spec.rb +0 -211
  26. data/spec/watirspec/divs_spec.rb +0 -31
  27. data/spec/watirspec/dl_spec.rb +0 -123
  28. data/spec/watirspec/dls_spec.rb +0 -32
  29. data/spec/watirspec/dt_spec.rb +0 -123
  30. data/spec/watirspec/dts_spec.rb +0 -31
  31. data/spec/watirspec/element_spec.rb +0 -89
  32. data/spec/watirspec/em_spec.rb +0 -97
  33. data/spec/watirspec/ems_spec.rb +0 -32
  34. data/spec/watirspec/filefield_spec.rb +0 -119
  35. data/spec/watirspec/filefields_spec.rb +0 -32
  36. data/spec/watirspec/form_spec.rb +0 -63
  37. data/spec/watirspec/forms_spec.rb +0 -33
  38. data/spec/watirspec/frame_spec.rb +0 -129
  39. data/spec/watirspec/frames_spec.rb +0 -62
  40. data/spec/watirspec/hidden_spec.rb +0 -102
  41. data/spec/watirspec/hiddens_spec.rb +0 -32
  42. data/spec/watirspec/hn_spec.rb +0 -93
  43. data/spec/watirspec/hns_spec.rb +0 -38
  44. data/spec/watirspec/image_spec.rb +0 -207
  45. data/spec/watirspec/images_spec.rb +0 -31
  46. data/spec/watirspec/label_spec.rb +0 -75
  47. data/spec/watirspec/labels_spec.rb +0 -31
  48. data/spec/watirspec/li_spec.rb +0 -112
  49. data/spec/watirspec/lib/guards.rb +0 -59
  50. data/spec/watirspec/lib/server.rb +0 -127
  51. data/spec/watirspec/lib/spec_helper.rb +0 -79
  52. data/spec/watirspec/lib/watirspec.rb +0 -72
  53. data/spec/watirspec/link_spec.rb +0 -168
  54. data/spec/watirspec/links_spec.rb +0 -35
  55. data/spec/watirspec/lis_spec.rb +0 -31
  56. data/spec/watirspec/map_spec.rb +0 -76
  57. data/spec/watirspec/maps_spec.rb +0 -32
  58. data/spec/watirspec/meta_spec.rb +0 -22
  59. data/spec/watirspec/metas_spec.rb +0 -30
  60. data/spec/watirspec/ol_spec.rb +0 -78
  61. data/spec/watirspec/ols_spec.rb +0 -31
  62. data/spec/watirspec/option_spec.rb +0 -173
  63. data/spec/watirspec/p_spec.rb +0 -128
  64. data/spec/watirspec/pre_spec.rb +0 -112
  65. data/spec/watirspec/pres_spec.rb +0 -31
  66. data/spec/watirspec/ps_spec.rb +0 -31
  67. data/spec/watirspec/radio_spec.rb +0 -255
  68. data/spec/watirspec/radios_spec.rb +0 -32
  69. data/spec/watirspec/select_list_spec.rb +0 -318
  70. data/spec/watirspec/select_lists_spec.rb +0 -35
  71. data/spec/watirspec/span_spec.rb +0 -142
  72. data/spec/watirspec/spans_spec.rb +0 -31
  73. data/spec/watirspec/spec_helper.rb +0 -17
  74. data/spec/watirspec/strong_spec.rb +0 -89
  75. data/spec/watirspec/strongs_spec.rb +0 -32
  76. data/spec/watirspec/table_bodies_spec.rb +0 -45
  77. data/spec/watirspec/table_body_spec.rb +0 -98
  78. data/spec/watirspec/table_cell_spec.rb +0 -68
  79. data/spec/watirspec/table_cells_spec.rb +0 -47
  80. data/spec/watirspec/table_footer_spec.rb +0 -85
  81. data/spec/watirspec/table_footers_spec.rb +0 -47
  82. data/spec/watirspec/table_header_spec.rb +0 -85
  83. data/spec/watirspec/table_headers_spec.rb +0 -45
  84. data/spec/watirspec/table_row_spec.rb +0 -87
  85. data/spec/watirspec/table_rows_spec.rb +0 -50
  86. data/spec/watirspec/table_spec.rb +0 -160
  87. data/spec/watirspec/tables_spec.rb +0 -33
  88. data/spec/watirspec/text_field_spec.rb +0 -276
  89. data/spec/watirspec/text_fields_spec.rb +0 -35
  90. data/spec/watirspec/ul_spec.rb +0 -76
  91. data/spec/watirspec/uls_spec.rb +0 -33
  92. data/support/html5/idl_extractor.rb +0 -73
@@ -1,33 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "Forms" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- describe "#length" do
11
- it "returns the number of forms in the container" do
12
- browser.forms.length.should == 2
13
- end
14
- end
15
-
16
- describe "#[]n" do
17
- it "provides access to the nth form" do
18
- browser.forms[0].action.should == 'post_to_me'
19
- browser.forms[0].attribute_value('method').should == 'post'
20
- end
21
- end
22
-
23
- describe "#each" do
24
- it "iterates through forms correctly" do
25
- browser.forms.each_with_index do |f, index|
26
- f.name.should == browser.form(:index, index).name
27
- f.id.should == browser.form(:index, index).id
28
- f.class_name.should == browser.form(:index, index).class_name
29
- end
30
- end
31
- end
32
-
33
- end
@@ -1,129 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "Frame" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/frames.html")
8
- end
9
-
10
- it "handles crossframe javascript" do
11
- browser.frame(:id, "frame_1").text_field(:name, 'senderElement').value.should == 'send_this_value'
12
- browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'old_value'
13
- browser.frame(:id, "frame_1").button(:id, 'send').click
14
- browser.frame(:id, "frame_2").text_field(:name, 'recieverElement').value.should == 'send_this_value'
15
- end
16
-
17
- not_compliant_on :watir do
18
- describe "#exist?" do
19
- it "returns true if the frame exists" do
20
- browser.frame(:id, "frame_1").should exist
21
- browser.frame(:id, /frame/).should exist
22
- browser.frame(:name, "frame1").should exist
23
- browser.frame(:name, /frame/).should exist
24
- browser.frame(:src, "frame_1.html").should exist
25
- browser.frame(:src, /frame_1/).should exist
26
- browser.frame(:class, "half").should exist
27
- browser.frame(:class, /half/).should exist
28
- browser.frame(:index, 0).should exist
29
- browser.frame(:xpath, "//frame[@id='frame_1']").should exist
30
- end
31
-
32
- it "returns true if the iframe exists" do
33
- browser.goto(WatirSpec.files + "/iframes.html")
34
- browser.frame(:id, "frame_1").should exist
35
- browser.frame(:id, /frame/).should exist
36
- browser.frame(:name, "frame1").should exist
37
- browser.frame(:name, /frame/).should exist
38
- browser.frame(:src, "frame_1.html").should exist
39
- browser.frame(:src, /frame_1/).should exist
40
- browser.frame(:class, "iframe").should exist
41
- browser.frame(:class, /iframe/).should exist
42
- browser.frame(:index, 0).should exist
43
- browser.frame(:xpath, "//iframe[@id='frame_1']").should exist
44
- end
45
-
46
- it "returns false if the frame doesn't exist" do
47
- browser.frame(:id, "no_such_id").should_not exist
48
- browser.frame(:id, /no_such_id/).should_not exist
49
- browser.frame(:name, "no_such_text").should_not exist
50
- browser.frame(:name, /no_such_text/).should_not exist
51
- browser.frame(:src, "no_such_src").should_not exist
52
- browser.frame(:src, /no_such_src/).should_not exist
53
- browser.frame(:class, "no_such_class").should_not exist
54
- browser.frame(:class, /no_such_class/).should_not exist
55
- browser.frame(:index, 1337).should_not exist
56
- browser.frame(:xpath, "//frame[@id='no_such_id']").should_not exist
57
- end
58
-
59
- it "raises TypeError when 'what' argument is invalid" do
60
- lambda { browser.frame(:id, 3.14).exists? }.should raise_error(TypeError)
61
- end
62
-
63
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
64
- lambda { browser.frame(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
65
- end
66
- end
67
- end
68
-
69
- it "raises UnknownFrameException when accessing elements inside non-existing frame" do
70
- lambda { browser.frame(:name, "no_such_name").p(:index, 0).id }.should raise_error(UnknownFrameException)
71
- end
72
-
73
- it "raises UnknownFrameException when accessing a non-existing frame" do
74
- lambda { browser.frame(:name, "no_such_name").id }.should raise_error(UnknownFrameException)
75
- end
76
-
77
- it "raises UnknownFrameException when accessing a non-existing subframe" do
78
- lambda { browser.frame(:name, "frame1").frame(:name, "no_such_name").id }.should raise_error(UnknownFrameException)
79
- end
80
-
81
- it "raises UnknownObjectException when accessing a non-existing element inside an existing frame" do
82
- lambda { browser.frame(:index, 0).p(:index, 1337).id }.should raise_error(UnknownObjectException)
83
- end
84
-
85
- it "raises NoMethodError when trying to access attributes it doesn't have" do
86
- lambda { browser.frame(:index, 0).foo }.should raise_error(NoMethodError)
87
- end
88
-
89
- it "is able to send a value to another frame by using Javascript" do
90
- frame1, frame2 = browser.frame(:index, 0), browser.frame(:index, 1)
91
- frame1.text_field(:index, 0).value.should == "send_this_value"
92
- frame2.text_field(:index, 0).value.should == "old_value"
93
- frame1.button(:index, 0).click
94
- frame2.text_field(:index, 0).value.should == "send_this_value"
95
- end
96
-
97
- it "is able to set a field" do
98
- browser.frame(:index, 0).text_field(:name, 'senderElement').set("new value")
99
- browser.frame(:index, 0).text_field(:name, 'senderElement').value.should == "new value"
100
- end
101
-
102
- not_compliant_on :watir do
103
- describe "#execute_script" do
104
- it "executes the given javascript in the specified frame" do
105
- frame = browser.frame(:index, 0)
106
- frame.div(:id, 'set_by_js').text.should == ""
107
- frame.execute_script(%Q{document.getElementById('set_by_js').innerHTML = 'Art consists of limitation. The most beautiful part of every picture is the frame.'})
108
- frame.div(:id, 'set_by_js').text.should == "Art consists of limitation. The most beautiful part of every picture is the frame."
109
- end
110
- end
111
-
112
- describe "#elements_by_xpath" do
113
- before :each do
114
- browser.goto(WatirSpec.files + "/iframes.html")
115
- end
116
-
117
- it "returns an Array of matching elements" do
118
- objects = browser.frame(:index, 0).elements_by_xpath("/html")
119
- objects.size.should == 1
120
- end
121
-
122
- it "returns an empty Array if there are no matching elements" do
123
- objects = browser.frame(:index, 0).elements_by_xpath("//*[@type='foobar']")
124
- objects.size.should == 0
125
- end
126
- end
127
-
128
- end
129
- end
@@ -1,62 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- not_compliant_on :watir do
5
- describe "<frame> Frames" do
6
-
7
- before :each do
8
- browser.goto(WatirSpec.files + "/frames.html")
9
- end
10
-
11
- describe "#length" do
12
- it "returns the correct number of frames" do
13
- browser.frames.length.should == 2
14
- end
15
- end
16
-
17
- describe "#[]" do
18
- it "returns the frame at the given index" do
19
- browser.frames[0].id.should == "frame_1"
20
- end
21
- end
22
-
23
- describe "#each" do
24
- it "iterates through frames correctly" do
25
- browser.frames.each_with_index do |f, index|
26
- f.id.should == browser.frame(:index, index).id
27
- f.value.should == browser.frame(:index, index).value
28
- end
29
- end
30
- end
31
- end
32
-
33
- describe "<iframe> Frames" do
34
-
35
- before :each do
36
- browser.goto(WatirSpec.files + "/iframes.html")
37
- end
38
-
39
- describe "#length" do
40
- it "returns the correct number of frames" do
41
- browser.frames.length.should == 2
42
- end
43
- end
44
-
45
- describe "#[]" do
46
- it "returns the frame at the given index" do
47
- browser.frames[0].id.should == "frame_1"
48
- end
49
- end
50
-
51
- describe "#each" do
52
- it "iterates through frames correctly" do
53
- browser.frames.each_with_index do |f, index|
54
- f.name.should == browser.frame(:index, index).name
55
- f.id.should == browser.frame(:index, index).id
56
- f.value.should == browser.frame(:index, index).value
57
- end
58
- end
59
- end
60
- end
61
-
62
- end
@@ -1,102 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "Hidden" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- # Exist method
11
- describe "#exists?" do
12
- it "returns true if the element exists" do
13
- browser.hidden(:id, 'new_user_interests_dolls').should exist
14
- browser.hidden(:id, /new_user_interests_dolls/).should exist
15
- browser.hidden(:name, 'new_user_interests').should exist
16
- browser.hidden(:name, /new_user_interests/).should exist
17
- browser.hidden(:value, 'dolls').should exist
18
- browser.hidden(:value, /dolls/).should exist
19
- # TODO: figure out what :text means for Hidden
20
- # browser.hidden(:text, 'dolls').should exist
21
- # browser.hidden(:text, /dolls/).should exist
22
- browser.hidden(:class, 'fun').should exist
23
- browser.hidden(:class, /fun/).should exist
24
- browser.hidden(:index, 0).should exist
25
- browser.hidden(:xpath, "//input[@id='new_user_interests_dolls']").should exist
26
- end
27
-
28
- it "returns false if the element does not exist" do
29
- browser.hidden(:id, 'no_such_id').should_not exist
30
- browser.hidden(:id, /no_such_id/).should_not exist
31
- browser.hidden(:name, 'no_such_name').should_not exist
32
- browser.hidden(:name, /no_such_name/).should_not exist
33
- browser.hidden(:value, 'no_such_value').should_not exist
34
- browser.hidden(:value, /no_such_value/).should_not exist
35
- browser.hidden(:text, 'no_such_text').should_not exist
36
- browser.hidden(:text, /no_such_text/).should_not exist
37
- browser.hidden(:class, 'no_such_class').should_not exist
38
- browser.hidden(:class, /no_such_class/).should_not exist
39
- browser.hidden(:index, 1337).should_not exist
40
- browser.hidden(:xpath, "//input[@id='no_such_id']").should_not exist
41
- end
42
-
43
- it "raises TypeError when 'what' argument is invalid" do
44
- lambda { browser.hidden(:id, 3.14).exists? }.should raise_error(TypeError)
45
- end
46
-
47
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
48
- lambda { browser.hidden(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
49
- end
50
- end
51
-
52
- # Attribute methods
53
- describe "#id" do
54
- it "returns the id attribute if the text field exists" do
55
- browser.hidden(:index, 0).id.should == "new_user_interests_dolls"
56
- end
57
-
58
- it "raises UnknownObjectException if the text field doesn't exist" do
59
- lambda { browser.hidden(:index, 1337).id }.should raise_error(UnknownObjectException)
60
- end
61
- end
62
-
63
- describe "#name" do
64
- it "returns the name attribute if the text field exists" do
65
- browser.hidden(:index, 0).name.should == "new_user_interests"
66
- end
67
-
68
- it "raises UnknownObjectException if the text field doesn't exist" do
69
- lambda { browser.hidden(:index, 1337).name }.should raise_error(UnknownObjectException)
70
- end
71
- end
72
-
73
- describe "#type" do
74
- it "returns the type attribute if the text field exists" do
75
- browser.hidden(:index, 0).type.should == "hidden"
76
- end
77
-
78
- it "raises UnknownObjectException if the text field doesn't exist" do
79
- lambda { browser.hidden(:index, 1337).type }.should raise_error(UnknownObjectException)
80
- end
81
- end
82
-
83
- describe "#value" do
84
- it "returns the value attribute if the text field exists" do
85
- browser.hidden(:index, 0).value.should == "dolls"
86
- end
87
-
88
- it "raises UnknownObjectException if the text field doesn't exist" do
89
- lambda { browser.hidden(:index, 1337).value }.should raise_error(UnknownObjectException)
90
- end
91
- end
92
-
93
- describe "#respond_to?" do
94
- it "returns true for all attribute methods" do
95
- browser.hidden(:index, 0).should respond_to(:id)
96
- browser.hidden(:index, 0).should respond_to(:name)
97
- browser.hidden(:index, 0).should respond_to(:type)
98
- browser.hidden(:index, 0).should respond_to(:value)
99
- end
100
- end
101
-
102
- end
@@ -1,32 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "Hiddens" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
8
- end
9
-
10
- describe "#length" do
11
- it "returns the number of hiddens" do
12
- browser.hiddens.length.should == 1
13
- end
14
- end
15
-
16
- describe "#[]" do
17
- it "returns the Hidden at the given index" do
18
- browser.hiddens[0].id.should == "new_user_interests_dolls"
19
- end
20
- end
21
-
22
- describe "#each" do
23
- it "iterates through hiddens correctly" do
24
- browser.hiddens.each_with_index do |h, index|
25
- h.name.should == browser.hidden(:index, index).name
26
- h.id.should == browser.hidden(:index, index).id
27
- h.value.should == browser.hidden(:index, index).value
28
- end
29
- end
30
- end
31
-
32
- end
@@ -1,93 +0,0 @@
1
- # encoding: utf-8
2
- require File.dirname(__FILE__) + '/spec_helper'
3
-
4
- describe "H1", "H2", "H3", "H4", "H5", "H6" do
5
-
6
- before :each do
7
- browser.goto(WatirSpec.files + "/non_control_elements.html")
8
- end
9
-
10
- # Exists method
11
- describe "#exist?" do
12
- it "returns true if the element exists" do
13
- browser.h1(:id, "header1").should exist
14
- browser.h2(:id, /header2/).should exist
15
- browser.h3(:text, "Header 3").should exist
16
- browser.h4(:text, /Header 4/).should exist
17
- browser.h5(:index, 0).should exist
18
- browser.h6(:index, 0).should exist
19
- browser.h1(:xpath, "//h1[@id='first_header']").should exist
20
- end
21
-
22
- it "returns true if the element exists" do
23
- browser.h1(:id, "no_such_id").should_not exist
24
- browser.h1(:id, /no_such_id/).should_not exist
25
- browser.h1(:text, "no_such_text").should_not exist
26
- browser.h1(:text, /no_such_text 1/).should_not exist
27
- browser.h1(:index, 1337).should_not exist
28
- browser.h1(:xpath, "//p[@id='no_such_id']").should_not exist
29
- end
30
-
31
- it "raises TypeError when 'what' argument is invalid" do
32
- lambda { browser.h1(:id, 3.14).exists? }.should raise_error(TypeError)
33
- end
34
-
35
- it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
36
- lambda { browser.h1(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
37
- end
38
- end
39
-
40
- # Attribute methods
41
- describe "#class_name" do
42
- it "returns the class attribute" do
43
- browser.h1(:index, 0).class_name.should == 'primary'
44
- end
45
-
46
- it "returns an empty string if the element exists and the attribute doesn't" do
47
- browser.h2(:index, 0).class_name.should == ''
48
- end
49
-
50
- it "raises UnknownObjectException if the p doesn't exist" do
51
- lambda { browser.h2(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
52
- end
53
- end
54
-
55
- describe "#id" do
56
- it "returns the id attribute" do
57
- browser.h1(:index, 0).id.should == "first_header"
58
- end
59
-
60
- it "returns an empty string if the element exists and the attribute doesn't" do
61
- browser.h3(:index, 0).id.should == ''
62
- end
63
-
64
- it "raises UnknownObjectException if the p doesn't exist" do
65
- lambda { browser.h1(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
66
- lambda { browser.h1(:index, 1337).id }.should raise_error(UnknownObjectException)
67
- end
68
- end
69
-
70
- describe "#text" do
71
- it "returns the text of the element" do
72
- browser.h1(:index, 0).text.should == 'Header 1'
73
- end
74
-
75
- it "returns an empty string if the element doesn't contain any text" do
76
- browser.h6(:id, "empty_header").text.should == ''
77
- end
78
-
79
- it "raises UnknownObjectException if the p doesn't exist" do
80
- lambda { browser.h1(:id, 'no_such_id').text }.should raise_error(UnknownObjectException)
81
- lambda { browser.h1(:xpath , "//h1[@id='no_such_id']").text }.should raise_error(UnknownObjectException)
82
- end
83
- end
84
-
85
- describe "#respond_to?" do
86
- it "returns true for all attribute methods" do
87
- browser.h1(:index, 0).should respond_to(:class_name)
88
- browser.h1(:index, 0).should respond_to(:id)
89
- browser.h1(:index, 0).should respond_to(:text)
90
- end
91
- end
92
-
93
- end