watir-webdriver 0.1.4 → 0.1.5
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.
- data/.gitignore +9 -0
- data/Gemfile +3 -3
- data/Rakefile +3 -28
- data/lib/watir-webdriver.rb +1 -0
- data/lib/watir-webdriver/version.rb +3 -0
- data/watir-webdriver.gemspec +23 -247
- metadata +34 -326
- data/VERSION +0 -1
- data/spec/watirspec/area_spec.rb +0 -77
- data/spec/watirspec/areas_spec.rb +0 -45
- data/spec/watirspec/browser_spec.rb +0 -274
- data/spec/watirspec/button_spec.rb +0 -255
- data/spec/watirspec/buttons_spec.rb +0 -58
- data/spec/watirspec/checkbox_spec.rb +0 -276
- data/spec/watirspec/checkboxes_spec.rb +0 -47
- data/spec/watirspec/collections_spec.rb +0 -20
- data/spec/watirspec/dd_spec.rb +0 -127
- data/spec/watirspec/dds_spec.rb +0 -45
- data/spec/watirspec/del_spec.rb +0 -145
- data/spec/watirspec/dels_spec.rb +0 -45
- data/spec/watirspec/div_spec.rb +0 -221
- data/spec/watirspec/divs_spec.rb +0 -45
- data/spec/watirspec/dl_spec.rb +0 -137
- data/spec/watirspec/dls_spec.rb +0 -46
- data/spec/watirspec/dt_spec.rb +0 -127
- data/spec/watirspec/dts_spec.rb +0 -45
- data/spec/watirspec/element_spec.rb +0 -149
- data/spec/watirspec/em_spec.rb +0 -101
- data/spec/watirspec/ems_spec.rb +0 -46
- data/spec/watirspec/filefield_spec.rb +0 -156
- data/spec/watirspec/filefields_spec.rb +0 -46
- data/spec/watirspec/font_spec.rb +0 -32
- data/spec/watirspec/form_spec.rb +0 -63
- data/spec/watirspec/forms_spec.rb +0 -47
- data/spec/watirspec/frame_spec.rb +0 -144
- data/spec/watirspec/frames_spec.rb +0 -83
- data/spec/watirspec/hidden_spec.rb +0 -103
- data/spec/watirspec/hiddens_spec.rb +0 -46
- data/spec/watirspec/hn_spec.rb +0 -97
- data/spec/watirspec/hns_spec.rb +0 -42
- data/spec/watirspec/image_spec.rb +0 -208
- data/spec/watirspec/images_spec.rb +0 -45
- data/spec/watirspec/ins_spec.rb +0 -146
- data/spec/watirspec/inses_spec.rb +0 -45
- data/spec/watirspec/label_spec.rb +0 -81
- data/spec/watirspec/labels_spec.rb +0 -45
- data/spec/watirspec/li_spec.rb +0 -116
- data/spec/watirspec/lib/guards.rb +0 -59
- data/spec/watirspec/lib/implementation.rb +0 -48
- data/spec/watirspec/lib/runner.rb +0 -83
- data/spec/watirspec/lib/server.rb +0 -194
- data/spec/watirspec/lib/watirspec.rb +0 -75
- data/spec/watirspec/link_spec.rb +0 -174
- data/spec/watirspec/links_spec.rb +0 -49
- data/spec/watirspec/lis_spec.rb +0 -45
- data/spec/watirspec/map_spec.rb +0 -80
- data/spec/watirspec/maps_spec.rb +0 -46
- data/spec/watirspec/meta_spec.rb +0 -24
- data/spec/watirspec/metas_spec.rb +0 -43
- data/spec/watirspec/ol_spec.rb +0 -90
- data/spec/watirspec/ols_spec.rb +0 -45
- data/spec/watirspec/option_spec.rb +0 -152
- data/spec/watirspec/p_spec.rb +0 -132
- data/spec/watirspec/pre_spec.rb +0 -116
- data/spec/watirspec/pres_spec.rb +0 -45
- data/spec/watirspec/ps_spec.rb +0 -45
- data/spec/watirspec/radio_spec.rb +0 -262
- data/spec/watirspec/radios_spec.rb +0 -46
- data/spec/watirspec/select_list_spec.rb +0 -335
- data/spec/watirspec/select_lists_spec.rb +0 -49
- data/spec/watirspec/span_spec.rb +0 -146
- data/spec/watirspec/spans_spec.rb +0 -45
- data/spec/watirspec/spec_helper.rb +0 -20
- data/spec/watirspec/strong_spec.rb +0 -93
- data/spec/watirspec/strongs_spec.rb +0 -46
- data/spec/watirspec/table_nesting_spec.rb +0 -50
- data/spec/watirspec/table_spec.rb +0 -150
- data/spec/watirspec/tables_spec.rb +0 -47
- data/spec/watirspec/tbody_spec.rb +0 -97
- data/spec/watirspec/tbodys_spec.rb +0 -65
- data/spec/watirspec/td_spec.rb +0 -72
- data/spec/watirspec/tds_spec.rb +0 -60
- data/spec/watirspec/text_field_spec.rb +0 -283
- data/spec/watirspec/text_fields_spec.rb +0 -49
- data/spec/watirspec/tfoot_spec.rb +0 -92
- data/spec/watirspec/tfoots_spec.rb +0 -71
- data/spec/watirspec/thead_spec.rb +0 -92
- data/spec/watirspec/theads_spec.rb +0 -71
- data/spec/watirspec/tr_spec.rb +0 -88
- data/spec/watirspec/trs_spec.rb +0 -68
- data/spec/watirspec/ul_spec.rb +0 -80
- data/spec/watirspec/uls_spec.rb +0 -44
- data/spec/watirspec/window_switching_spec.rb +0 -164
data/spec/watirspec/dds_spec.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Dds" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/definition_lists.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
11
|
-
describe "with selectors" do
|
12
|
-
it "returns the matching elements" do
|
13
|
-
browser.dds(:text => "11 years").to_a.should == [browser.dd(:text => "11 years")]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#length" do
|
19
|
-
it "returns the number of dds" do
|
20
|
-
browser.dds.length.should == 11
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#[]" do
|
25
|
-
it "returns the dd at the given index" do
|
26
|
-
browser.dds[1].title.should == "education"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "iterates through dds correctly" do
|
32
|
-
count = 0
|
33
|
-
|
34
|
-
browser.dds.each_with_index do |d, index|
|
35
|
-
d.id.should == browser.dd(:index, index).id
|
36
|
-
d.class_name.should == browser.dd(:index, index).class_name
|
37
|
-
|
38
|
-
count += 1
|
39
|
-
end
|
40
|
-
|
41
|
-
count.should > 0
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/spec/watirspec/del_spec.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Del" 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 'del' exists" do
|
13
|
-
browser.del(:id, "lead").should exist
|
14
|
-
browser.del(:id, /lead/).should exist
|
15
|
-
browser.del(:text, "This is a deleted text tag 1").should exist
|
16
|
-
browser.del(:text, /This is a deleted text tag 1/).should exist
|
17
|
-
browser.del(:class, "lead").should exist
|
18
|
-
browser.del(:class, /lead/).should exist
|
19
|
-
browser.del(:index, 0).should exist
|
20
|
-
browser.del(:xpath, "//del[@id='lead']").should exist
|
21
|
-
end
|
22
|
-
|
23
|
-
it "returns the first del if given no args" do
|
24
|
-
browser.del.should exist
|
25
|
-
end
|
26
|
-
|
27
|
-
it "returns false if the element doesn't exist" do
|
28
|
-
browser.del(:id, "no_such_id").should_not exist
|
29
|
-
browser.del(:id, /no_such_id/).should_not exist
|
30
|
-
browser.del(:text, "no_such_text").should_not exist
|
31
|
-
browser.del(:text, /no_such_text/).should_not exist
|
32
|
-
browser.del(:class, "no_such_class").should_not exist
|
33
|
-
browser.del(:class, /no_such_class/).should_not exist
|
34
|
-
browser.del(:index, 1337).should_not exist
|
35
|
-
browser.del(:xpath, "//del[@id='no_such_id']").should_not exist
|
36
|
-
end
|
37
|
-
|
38
|
-
it "raises TypeError when 'what' argument is invalid" do
|
39
|
-
lambda { browser.del(:id, 3.14).exists? }.should raise_error(TypeError)
|
40
|
-
end
|
41
|
-
|
42
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
43
|
-
lambda { browser.del(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# Attribute methods
|
48
|
-
describe "#class_name" do
|
49
|
-
it "returns the class attribute" do
|
50
|
-
browser.del(:index, 0).class_name.should == 'lead'
|
51
|
-
end
|
52
|
-
|
53
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
54
|
-
browser.del(:index, 2).class_name.should == ''
|
55
|
-
end
|
56
|
-
|
57
|
-
it "raises UnknownObjectException if the del doesn't exist" do
|
58
|
-
lambda { browser.del(:id, 'no_such_id').class_name }.should raise_error(UnknownObjectException)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "#id" do
|
63
|
-
it "returns the id attribute" do
|
64
|
-
browser.del(:index, 0).id.should == "lead"
|
65
|
-
end
|
66
|
-
|
67
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
68
|
-
browser.del(:index, 2).id.should == ''
|
69
|
-
end
|
70
|
-
|
71
|
-
it "raises UnknownObjectException if the del doesn't exist" do
|
72
|
-
lambda { browser.del(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
73
|
-
lambda { browser.del(:index, 1337).id }.should raise_error(UnknownObjectException)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "#title" do
|
78
|
-
it "returns the title attribute" do
|
79
|
-
browser.del(:index, 0).title.should == 'Lorem ipsum'
|
80
|
-
end
|
81
|
-
|
82
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
83
|
-
browser.del(:index, 2).title.should == ''
|
84
|
-
end
|
85
|
-
|
86
|
-
it "raises UnknownObjectException if the del doesn't exist" do
|
87
|
-
lambda { browser.del(:id, 'no_such_id').title }.should raise_error( UnknownObjectException)
|
88
|
-
lambda { browser.del(:xpath, "//del[@id='no_such_id']").title }.should raise_error( UnknownObjectException)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "#text" do
|
93
|
-
it "returns the text of the del" do
|
94
|
-
browser.del(:index, 1).text.should == 'This is a deleted text tag 2'
|
95
|
-
end
|
96
|
-
|
97
|
-
it "returns an empty string if the element doesn't contain any text" do
|
98
|
-
browser.del(:index, 3).text.should == ''
|
99
|
-
end
|
100
|
-
|
101
|
-
it "raises UnknownObjectException if the del doesn't exist" do
|
102
|
-
lambda { browser.del(:id, 'no_such_id').text }.should raise_error( UnknownObjectException)
|
103
|
-
lambda { browser.del(:xpath , "//del[@id='no_such_id']").text }.should raise_error( UnknownObjectException)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe "#value" do
|
108
|
-
it "returns the value attribute" do
|
109
|
-
browser.del(:index, 1).value.should == "invalid_attribute"
|
110
|
-
end
|
111
|
-
|
112
|
-
it "returns an empty string if the element exists and the attribute doesn't" do
|
113
|
-
browser.del(:index, 3).value.should == ''
|
114
|
-
end
|
115
|
-
|
116
|
-
it "raises UnknownObjectException if the del doesn't exist" do
|
117
|
-
lambda { browser.del(:id , "no_such_id").value }.should raise_error(UnknownObjectException)
|
118
|
-
lambda { browser.del(:index , 1337).value }.should raise_error(UnknownObjectException)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe "#respond_to?" do
|
123
|
-
it "returns true for all attribute methods" do
|
124
|
-
browser.del(:index, 0).should respond_to(:class_name)
|
125
|
-
browser.del(:index, 0).should respond_to(:id)
|
126
|
-
browser.del(:index, 0).should respond_to(:title)
|
127
|
-
browser.del(:index, 0).should respond_to(:text)
|
128
|
-
browser.del(:index, 0).should respond_to(:value)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
# Other
|
133
|
-
describe "#click" do
|
134
|
-
it "fires events" do
|
135
|
-
browser.del(:class, 'footer').text.should_not include('Javascript')
|
136
|
-
browser.del(:class, 'footer').click
|
137
|
-
browser.del(:class, 'footer').text.should include('Javascript')
|
138
|
-
end
|
139
|
-
|
140
|
-
it "raises UnknownObjectException if the del doesn't exist" do
|
141
|
-
lambda { browser.del(:id, "no_such_id").click }.should raise_error(UnknownObjectException)
|
142
|
-
lambda { browser.del(:title, "no_such_title").click }.should raise_error(UnknownObjectException)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
data/spec/watirspec/dels_spec.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Dels" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
bug "http://github.com/jarib/celerity/issues#issue/25", :celerity do
|
11
|
-
describe "with selectors" do
|
12
|
-
it "returns the matching elements" do
|
13
|
-
browser.dels(:class => "lead").to_a.should == [browser.del(:class => "lead")]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "#length" do
|
19
|
-
it "returns the number of dels" do
|
20
|
-
browser.dels.length.should == 5
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "#[]" do
|
25
|
-
it "returns the del at the given index" do
|
26
|
-
browser.dels[0].id.should == "lead"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "#each" do
|
31
|
-
it "iterates through dels correctly" do
|
32
|
-
count = 0
|
33
|
-
|
34
|
-
browser.dels.each_with_index do |s, index|
|
35
|
-
s.id.should == browser.del(:index, index).id
|
36
|
-
s.value.should == browser.del(:index, index).value
|
37
|
-
|
38
|
-
count += 1
|
39
|
-
end
|
40
|
-
|
41
|
-
count.should > 0
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/spec/watirspec/div_spec.rb
DELETED
@@ -1,221 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require File.expand_path("../spec_helper", __FILE__)
|
3
|
-
|
4
|
-
describe "Div" do
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
browser.goto(WatirSpec.files + "/non_control_elements.html")
|
8
|
-
end
|
9
|
-
|
10
|
-
# Exists method
|
11
|
-
describe "#exists?" do
|
12
|
-
it "returns true if the element exists" do
|
13
|
-
browser.div(:id, "header").should exist
|
14
|
-
browser.div(:id, /header/).should exist
|
15
|
-
browser.div(:title, "Header and primary navigation").should exist
|
16
|
-
browser.div(:title, /Header and primary navigation/).should exist
|
17
|
-
browser.div(:text, "This is a footer.").should exist
|
18
|
-
browser.div(:text, /This is a footer\./).should exist
|
19
|
-
browser.div(:class, "profile").should exist
|
20
|
-
browser.div(:class, /profile/).should exist
|
21
|
-
browser.div(:index, 0).should exist
|
22
|
-
browser.div(:xpath, "//div[@id='header']").should exist
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns the first div if given no args" do
|
26
|
-
browser.div.should exist
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns false if the element does not exist" do
|
30
|
-
browser.div(:id, "no_such_id").should_not exist
|
31
|
-
browser.div(:id, /no_such_id/).should_not exist
|
32
|
-
browser.div(:title, "no_such_title").should_not exist
|
33
|
-
browser.div(:title, /no_such_title/).should_not exist
|
34
|
-
browser.div(:text, "no_such_text").should_not exist
|
35
|
-
browser.div(:text, /no_such_text/).should_not exist
|
36
|
-
browser.div(:class, "no_such_class").should_not exist
|
37
|
-
browser.div(:class, /no_such_class/).should_not exist
|
38
|
-
browser.div(:index, 1337).should_not exist
|
39
|
-
browser.div(:xpath, "//div[@id='no_such_id']").should_not exist
|
40
|
-
end
|
41
|
-
|
42
|
-
it "raises TypeError when 'what' argument is invalid" do
|
43
|
-
lambda { browser.div(:id, 3.14).exists? }.should raise_error(TypeError)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "raises MissingWayOfFindingObjectException when 'how' argument is invalid" do
|
47
|
-
lambda { browser.div(:no_such_how, 'some_value').exists? }.should raise_error(MissingWayOfFindingObjectException)
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
# Attribute methods
|
53
|
-
describe "#class_name" do
|
54
|
-
it "returns the class attribute if the element exists" do
|
55
|
-
browser.div(:id, "footer").class_name.should == "profile"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "returns an empty string if the element exists but the attribute doesn't" do
|
59
|
-
browser.div(:id, "content").class_name.should == ""
|
60
|
-
end
|
61
|
-
|
62
|
-
it "raises UnknownObjectException if the element does not exist" do
|
63
|
-
lambda { browser.div(:id, "no_such_id").class_name }.should raise_error(UnknownObjectException)
|
64
|
-
lambda { browser.div(:title, "no_such_title").class_name }.should raise_error(UnknownObjectException)
|
65
|
-
lambda { browser.div(:index, 1337).class_name }.should raise_error(UnknownObjectException)
|
66
|
-
lambda { browser.div(:xpath, "//div[@id='no_such_id']").class_name }.should raise_error(UnknownObjectException)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "#id" do
|
71
|
-
it "returns the id attribute if the element exists" do
|
72
|
-
browser.div(:index, 1).id.should == "outer_container"
|
73
|
-
end
|
74
|
-
|
75
|
-
it "returns an empty string if the element exists, but the attribute doesn't" do
|
76
|
-
browser.div(:index, 0).id.should == ""
|
77
|
-
end
|
78
|
-
|
79
|
-
it "raises UnknownObjectException if the element does not exist" do
|
80
|
-
lambda { browser.div(:id, "no_such_id").id }.should raise_error(UnknownObjectException)
|
81
|
-
lambda { browser.div(:title, "no_such_id").id }.should raise_error(UnknownObjectException)
|
82
|
-
lambda { browser.div(:index, 1337).id }.should raise_error(UnknownObjectException)
|
83
|
-
end
|
84
|
-
|
85
|
-
it "should take all conditions into account when locating by id" do
|
86
|
-
browser.goto "#{WatirSpec.files}/multiple_ids.html"
|
87
|
-
browser.div(:id => "multiple", :class => "bar").class_name.should == "bar"
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe "#style" do
|
92
|
-
not_compliant_on [:webdriver, :ie] do
|
93
|
-
it "returns the style attribute if the element exists" do
|
94
|
-
browser.div(:id, 'best_language').style.should == "color: red; text-decoration: underline; cursor: pointer;"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
deviates_on [:webdriver, :ie] do
|
99
|
-
it "returns the style attribute if the element exists" do
|
100
|
-
browser.div(:id, 'best_language').style.should == "COLOR: red; CURSOR: pointer; TEXT-DECORATION: underline"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
it "returns an empty string if the element exists but the attribute doesn't" do
|
105
|
-
browser.div(:id, 'promo').style.should == ""
|
106
|
-
end
|
107
|
-
|
108
|
-
it "raises UnknownObjectException if the element does not exist" do
|
109
|
-
lambda {browser.div(:id, "no_such_id").style }.should raise_error(UnknownObjectException)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe "#text" do
|
114
|
-
it "returns the text of the div" do
|
115
|
-
browser.div(:id, "footer").text.strip.should == "This is a footer."
|
116
|
-
browser.div(:title, "Closing remarks").text.strip.should == "This is a footer."
|
117
|
-
browser.div(:xpath, "//div[@id='footer']").text.strip.should == "This is a footer."
|
118
|
-
end
|
119
|
-
|
120
|
-
it "returns an empty string if the element exists but contains no text" do
|
121
|
-
browser.div(:index, 0).text.strip.should == ""
|
122
|
-
end
|
123
|
-
|
124
|
-
it "returns an empty string if the div is hidden" do
|
125
|
-
browser.div(:id, 'hidden').text.should == ""
|
126
|
-
end
|
127
|
-
|
128
|
-
it "raises UnknownObjectException if the element does not exist" do
|
129
|
-
lambda { browser.div(:id, "no_such_id").text }.should raise_error(UnknownObjectException)
|
130
|
-
lambda { browser.div(:title, "no_such_title").text }.should raise_error(UnknownObjectException)
|
131
|
-
lambda { browser.div(:index, 1337).text }.should raise_error(UnknownObjectException)
|
132
|
-
lambda { browser.div(:xpath, "//div[@id='no_such_id']").text }.should raise_error(UnknownObjectException)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe "#value" do
|
137
|
-
it "returns the value attribute if the element exists" do
|
138
|
-
browser.div(:id, 'promo').value.should == "invalid_attribute"
|
139
|
-
end
|
140
|
-
|
141
|
-
it "returns an empty string if the element exists but the attribute doesn't" do
|
142
|
-
browser.div(:index, 0).value.should == ""
|
143
|
-
end
|
144
|
-
|
145
|
-
it "raises UnknownObjectException if the element does not exist" do
|
146
|
-
lambda {browser.div(:id, "no_such_id").value }.should raise_error(UnknownObjectException)
|
147
|
-
lambda {browser.div(:title, "no_such_title").value }.should raise_error(UnknownObjectException)
|
148
|
-
lambda {browser.div(:index, 1337).value }.should raise_error(UnknownObjectException)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
describe "#respond_to?" do
|
153
|
-
it "returns true for all attribute methods" do
|
154
|
-
browser.div(:index, 0).should respond_to(:class_name)
|
155
|
-
browser.div(:index, 0).should respond_to(:id)
|
156
|
-
browser.div(:index, 0).should respond_to(:style)
|
157
|
-
browser.div(:index, 0).should respond_to(:text)
|
158
|
-
browser.div(:index, 0).should respond_to(:value)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
# Manipulation methods
|
163
|
-
describe "#click" do
|
164
|
-
it "fires events when clicked" do
|
165
|
-
browser.div(:id, 'best_language').text.should_not == 'Ruby!'
|
166
|
-
browser.div(:id, 'best_language').click
|
167
|
-
browser.div(:id, 'best_language').text.should == 'Ruby!'
|
168
|
-
end
|
169
|
-
|
170
|
-
it "raises UnknownObjectException if the element does not exist" do
|
171
|
-
lambda { browser.div(:id, "no_such_id").click }.should raise_error(UnknownObjectException)
|
172
|
-
lambda { browser.div(:title, "no_such_title").click }.should raise_error(UnknownObjectException)
|
173
|
-
lambda { browser.div(:index, 1337).click }.should raise_error(UnknownObjectException)
|
174
|
-
lambda { browser.div(:xpath, "//div[@id='no_such_id']").click }.should raise_error(UnknownObjectException)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
not_compliant_on :webdriver do
|
179
|
-
describe "#double_click" do
|
180
|
-
it "fires the ondblclick event" do
|
181
|
-
browser.div(:id, 'html_test').double_click
|
182
|
-
messages.should include('double clicked')
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
describe "#right_click" do
|
187
|
-
it "fires the oncontextmenu event" do
|
188
|
-
browser.goto(WatirSpec.files + "/right_click.html")
|
189
|
-
browser.div(:id, "click").right_click
|
190
|
-
messages.first.should == 'right-clicked'
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
describe "#html" do
|
196
|
-
not_compliant_on [:webdriver, :ie] do
|
197
|
-
it "returns the HTML of the element" do
|
198
|
-
html = browser.div(:id, 'footer').html.downcase
|
199
|
-
html.should include('id="footer"')
|
200
|
-
html.should include('title="closing remarks"')
|
201
|
-
html.should include('class="profile"')
|
202
|
-
|
203
|
-
html.should_not include('<div id="content">')
|
204
|
-
html.should_not include('</body>')
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
deviates_on [:webdriver, :ie] do
|
209
|
-
it "returns the HTML of the element" do
|
210
|
-
html = browser.div(:id, 'footer').html.downcase
|
211
|
-
html.should include('id=footer')
|
212
|
-
html.should include('title="closing remarks"')
|
213
|
-
html.should include('class=profile')
|
214
|
-
|
215
|
-
html.should_not include('<div id=content>')
|
216
|
-
html.should_not include('</body>')
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
end
|