|
25 | 25 | driver.title.should == "XHTML Test Page"
|
26 | 26 | end
|
27 | 27 |
|
28 |
| - it "should get the page source" do |
29 |
| - driver.navigate.to url_for("xhtmlTest.html") |
30 |
| - driver.page_source.should match(%r[<title>XHTML Test Page</title>]i) |
| 28 | + # Edge does not yet support session/:sessionId/source http://dev.modern.ie/platform/status/webdriver/details/ |
| 29 | + not_compliant_on :browser => :edge do |
| 30 | + it "should get the page source" do |
| 31 | + driver.navigate.to url_for("xhtmlTest.html") |
| 32 | + driver.page_source.should match(%r[<title>XHTML Test Page</title>]i) |
| 33 | + end |
31 | 34 | end
|
32 | 35 |
|
33 |
| - |
34 | 36 | not_compliant_on :browser => :safari do
|
35 | 37 | it "should refresh the page" do
|
36 | 38 | driver.navigate.to url_for("javascriptPage.html")
|
37 |
| - driver.find_element(:link_text, 'Update a div').click |
| 39 | + driver.find_element(:id, 'updatediv').click |
38 | 40 | driver.find_element(:id, 'dynamo').text.should == "Fish and chips!"
|
39 | 41 | driver.navigate.refresh
|
40 | 42 | driver.find_element(:id, 'dynamo').text.should == "What's for dinner?"
|
|
91 | 93 | driver.find_element(:link, "Foo").text.should == "Foo"
|
92 | 94 | end
|
93 | 95 |
|
94 |
| - it "should find by xpath" do |
95 |
| - driver.navigate.to url_for("xhtmlTest.html") |
96 |
| - driver.find_element(:xpath, "//h1").text.should == "XHTML Might Be The Future" |
| 96 | + # Edge does not yet support xpath |
| 97 | + not_compliant_on :browser => :edge do |
| 98 | + it "should find by xpath" do |
| 99 | + driver.navigate.to url_for("xhtmlTest.html") |
| 100 | + driver.find_element(:xpath, "//h1").text.should == "XHTML Might Be The Future" |
| 101 | + end |
97 | 102 | end
|
98 | 103 |
|
99 | 104 | it "should find by css selector" do
|
|
106 | 111 | driver.find_element(:tag_name, 'div').attribute("class").should == "navigation"
|
107 | 112 | end
|
108 | 113 |
|
109 |
| - it "should find child element" do |
110 |
| - driver.navigate.to url_for("nestedElements.html") |
| 114 | + # Edge does not yet support session/:sessionId/element/:id/element |
| 115 | + # http://dev.modern.ie/platform/status/webdriver/details/ |
| 116 | + not_compliant_on :browser => :edge do |
| 117 | + it "should find child element" do |
| 118 | + driver.navigate.to url_for("nestedElements.html") |
111 | 119 |
|
112 |
| - element = driver.find_element(:name, "form2") |
113 |
| - child = element.find_element(:name, "selectomatic") |
| 120 | + element = driver.find_element(:name, "form2") |
| 121 | + child = element.find_element(:name, "selectomatic") |
114 | 122 |
|
115 |
| - child.attribute("id").should == "2" |
| 123 | + child.attribute("id").should == "2" |
| 124 | + end |
116 | 125 | end
|
117 | 126 |
|
118 |
| - it "should find child element by tag name" do |
119 |
| - driver.navigate.to url_for("nestedElements.html") |
| 127 | + # Edge does not yet support session/:sessionId/element/:id/element |
| 128 | + # http://dev.modern.ie/platform/status/webdriver/details/ |
| 129 | + not_compliant_on :browser => :edge do |
| 130 | + it "should find child element by tag name" do |
| 131 | + driver.navigate.to url_for("nestedElements.html") |
120 | 132 |
|
121 |
| - element = driver.find_element(:name, "form2") |
122 |
| - child = element.find_element(:tag_name, "select") |
| 133 | + element = driver.find_element(:name, "form2") |
| 134 | + child = element.find_element(:tag_name, "select") |
123 | 135 |
|
124 |
| - child.attribute("id").should == "2" |
| 136 | + child.attribute("id").should == "2" |
| 137 | + end |
125 | 138 | end
|
126 | 139 |
|
127 | 140 | it "should raise on nonexistant element" do
|
|
134 | 147 | driver.find_element(:class => "header").text.should == "XHTML Might Be The Future"
|
135 | 148 | end
|
136 | 149 |
|
137 |
| - it "should find elements with the shortcut syntax" do |
138 |
| - driver.navigate.to url_for("xhtmlTest.html") |
| 150 | + # Edge does not yet support xpath |
| 151 | + not_compliant_on :browser => :edge do |
| 152 | + it "should find elements with the shortcut syntax" do |
| 153 | + driver.navigate.to url_for("xhtmlTest.html") |
139 | 154 |
|
140 |
| - driver[:id1].should be_kind_of(WebDriver::Element) |
141 |
| - driver[:xpath => "//h1"].should be_kind_of(WebDriver::Element) |
| 155 | + driver[:id1].should be_kind_of(WebDriver::Element) |
| 156 | + driver[:xpath => "//h1"].should be_kind_of(WebDriver::Element) |
| 157 | + end |
142 | 158 | end
|
143 | 159 | end
|
144 | 160 |
|
|
153 | 169 | driver.find_elements(:css, 'p')
|
154 | 170 | end
|
155 | 171 |
|
156 |
| - it "should find children by field name" do |
157 |
| - driver.navigate.to url_for("nestedElements.html") |
158 |
| - element = driver.find_element(:name, "form2") |
159 |
| - children = element.find_elements(:name, "selectomatic") |
160 |
| - expect(children.size).to eq(2) |
| 172 | + # Edge does not yet support session/:sessionId/element/:id/element |
| 173 | + # http://dev.modern.ie/platform/status/webdriver/details/ |
| 174 | + not_compliant_on :browser => :edge do |
| 175 | + it "should find children by field name" do |
| 176 | + driver.navigate.to url_for("nestedElements.html") |
| 177 | + element = driver.find_element(:name, "form2") |
| 178 | + children = element.find_elements(:name, "selectomatic") |
| 179 | + expect(children.size).to eq(2) |
| 180 | + end |
161 | 181 | end
|
162 | 182 | end
|
163 | 183 |
|
164 |
| - describe "execute script" do |
165 |
| - it "should return strings" do |
166 |
| - driver.navigate.to url_for("xhtmlTest.html") |
167 |
| - driver.execute_script("return document.title;").should == "XHTML Test Page" |
168 |
| - end |
169 |
| - |
170 |
| - it "should return numbers" do |
171 |
| - driver.navigate.to url_for("xhtmlTest.html") |
172 |
| - driver.execute_script("return document.title.length;").should == "XHTML Test Page".length |
173 |
| - end |
| 184 | + # Microsoft Edge does not return javascriptEnabled when passed in as desired capabilities |
| 185 | + not_compliant_on :browser => :edge do |
| 186 | + describe "execute script" do |
| 187 | + it "should return strings" do |
| 188 | + driver.navigate.to url_for("xhtmlTest.html") |
| 189 | + driver.execute_script("return document.title;").should == "XHTML Test Page" |
| 190 | + end |
174 | 191 |
|
175 |
| - it "should return elements" do |
176 |
| - driver.navigate.to url_for("xhtmlTest.html") |
177 |
| - element = driver.execute_script("return document.getElementById('id1');") |
178 |
| - element.should be_kind_of(WebDriver::Element) |
179 |
| - element.text.should == "Foo" |
180 |
| - end |
| 192 | + it "should return numbers" do |
| 193 | + driver.navigate.to url_for("xhtmlTest.html") |
| 194 | + driver.execute_script("return document.title.length;").should == "XHTML Test Page".length |
| 195 | + end |
181 | 196 |
|
182 |
| - not_compliant_on :browser => [:android] do |
183 |
| - it "should unwrap elements in deep objects" do |
| 197 | + it "should return elements" do |
184 | 198 | driver.navigate.to url_for("xhtmlTest.html")
|
185 |
| - result = driver.execute_script(<<-SCRIPT) |
| 199 | + element = driver.execute_script("return document.getElementById('id1');") |
| 200 | + element.should be_kind_of(WebDriver::Element) |
| 201 | + element.text.should == "Foo" |
| 202 | + end |
| 203 | + |
| 204 | + not_compliant_on :browser => [:android] do |
| 205 | + it "should unwrap elements in deep objects" do |
| 206 | + driver.navigate.to url_for("xhtmlTest.html") |
| 207 | + result = driver.execute_script(<<-SCRIPT) |
186 | 208 | var e1 = document.getElementById('id1');
|
187 | 209 | var body = document.body;
|
188 | 210 |
|
189 | 211 | return {
|
190 | 212 | elements: {'body' : body, other: [e1] }
|
191 | 213 | };
|
192 |
| - SCRIPT |
| 214 | + SCRIPT |
193 | 215 |
|
194 |
| - result.should be_kind_of(Hash) |
195 |
| - result['elements']['body'].should be_kind_of(WebDriver::Element) |
196 |
| - result['elements']['other'].first.should be_kind_of(WebDriver::Element) |
| 216 | + result.should be_kind_of(Hash) |
| 217 | + result['elements']['body'].should be_kind_of(WebDriver::Element) |
| 218 | + result['elements']['other'].first.should be_kind_of(WebDriver::Element) |
| 219 | + end |
197 | 220 | end
|
198 |
| - end |
199 | 221 |
|
200 |
| - it "should return booleans" do |
201 |
| - driver.navigate.to url_for("xhtmlTest.html") |
202 |
| - driver.execute_script("return true;").should == true |
203 |
| - end |
| 222 | + it "should return booleans" do |
| 223 | + driver.navigate.to url_for("xhtmlTest.html") |
| 224 | + driver.execute_script("return true;").should == true |
| 225 | + end |
204 | 226 |
|
205 |
| - it "should raise if the script is bad" do |
206 |
| - driver.navigate.to url_for("xhtmlTest.html") |
207 |
| - lambda { driver.execute_script("return squiggle();") }.should raise_error |
208 |
| - end |
| 227 | + it "should raise if the script is bad" do |
| 228 | + driver.navigate.to url_for("xhtmlTest.html") |
| 229 | + lambda { driver.execute_script("return squiggle();") }.should raise_error |
| 230 | + end |
209 | 231 |
|
210 |
| - it "should return arrays" do |
211 |
| - driver.navigate.to url_for("xhtmlTest.html") |
212 |
| - driver.execute_script('return ["zero", "one", "two"];').should == %w[zero one two] |
213 |
| - end |
| 232 | + it "should return arrays" do |
| 233 | + driver.navigate.to url_for("xhtmlTest.html") |
| 234 | + driver.execute_script('return ["zero", "one", "two"];').should == %w[zero one two] |
| 235 | + end |
214 | 236 |
|
215 |
| - it "should be able to call functions on the page" do |
216 |
| - driver.navigate.to url_for("javascriptPage.html") |
217 |
| - driver.execute_script("displayMessage('I like cheese');") |
218 |
| - driver.find_element(:id, "result").text.strip.should == "I like cheese" |
219 |
| - end |
| 237 | + it "should be able to call functions on the page" do |
| 238 | + driver.navigate.to url_for("javascriptPage.html") |
| 239 | + driver.execute_script("displayMessage('I like cheese');") |
| 240 | + driver.find_element(:id, "result").text.strip.should == "I like cheese" |
| 241 | + end |
220 | 242 |
|
221 |
| - it "should be able to pass string arguments" do |
222 |
| - driver.navigate.to url_for("javascriptPage.html") |
223 |
| - driver.execute_script("return arguments[0] == 'fish' ? 'fish' : 'not fish';", "fish").should == "fish" |
224 |
| - end |
| 243 | + it "should be able to pass string arguments" do |
| 244 | + driver.navigate.to url_for("javascriptPage.html") |
| 245 | + driver.execute_script("return arguments[0] == 'fish' ? 'fish' : 'not fish';", "fish").should == "fish" |
| 246 | + end |
225 | 247 |
|
226 |
| - it "should be able to pass boolean arguments" do |
227 |
| - driver.navigate.to url_for("javascriptPage.html") |
228 |
| - driver.execute_script("return arguments[0] == true;", true).should == true |
229 |
| - end |
| 248 | + it "should be able to pass boolean arguments" do |
| 249 | + driver.navigate.to url_for("javascriptPage.html") |
| 250 | + driver.execute_script("return arguments[0] == true;", true).should == true |
| 251 | + end |
230 | 252 |
|
231 |
| - it "should be able to pass numeric arguments" do |
232 |
| - driver.navigate.to url_for("javascriptPage.html") |
233 |
| - driver.execute_script("return arguments[0] == 1 ? 1 : 0;", 1).should == 1 |
234 |
| - end |
| 253 | + it "should be able to pass numeric arguments" do |
| 254 | + driver.navigate.to url_for("javascriptPage.html") |
| 255 | + driver.execute_script("return arguments[0] == 1 ? 1 : 0;", 1).should == 1 |
| 256 | + end |
235 | 257 |
|
236 |
| - it "should be able to pass null arguments" do |
237 |
| - driver.navigate.to url_for("javascriptPage.html") |
238 |
| - driver.execute_script("return arguments[0];", nil).should == nil |
239 |
| - end |
| 258 | + it "should be able to pass null arguments" do |
| 259 | + driver.navigate.to url_for("javascriptPage.html") |
| 260 | + driver.execute_script("return arguments[0];", nil).should == nil |
| 261 | + end |
240 | 262 |
|
241 |
| - it "should be able to pass array arguments" do |
242 |
| - driver.navigate.to url_for("javascriptPage.html") |
243 |
| - driver.execute_script("return arguments[0];", [1, '2', 3]).should == [1, '2', 3] |
244 |
| - end |
| 263 | + it "should be able to pass array arguments" do |
| 264 | + driver.navigate.to url_for("javascriptPage.html") |
| 265 | + driver.execute_script("return arguments[0];", [1, '2', 3]).should == [1, '2', 3] |
| 266 | + end |
245 | 267 |
|
246 |
| - it "should be able to pass element arguments" do |
247 |
| - driver.navigate.to url_for("javascriptPage.html") |
248 |
| - button = driver.find_element(:id, "plainButton") |
249 |
| - driver.execute_script("arguments[0]['flibble'] = arguments[0].getAttribute('id'); return arguments[0]['flibble'];", button).should == "plainButton" |
250 |
| - end |
| 268 | + it "should be able to pass element arguments" do |
| 269 | + driver.navigate.to url_for("javascriptPage.html") |
| 270 | + button = driver.find_element(:id, "plainButton") |
| 271 | + driver.execute_script("arguments[0]['flibble'] = arguments[0].getAttribute('id'); return arguments[0]['flibble'];", button).should == "plainButton" |
| 272 | + end |
251 | 273 |
|
252 |
| - it "should be able to pass in multiple arguments" do |
253 |
| - driver.navigate.to url_for("javascriptPage.html") |
254 |
| - driver.execute_script("return arguments[0] + arguments[1];", "one", "two").should == "onetwo" |
| 274 | + it "should be able to pass in multiple arguments" do |
| 275 | + driver.navigate.to url_for("javascriptPage.html") |
| 276 | + driver.execute_script("return arguments[0] + arguments[1];", "one", "two").should == "onetwo" |
| 277 | + end |
255 | 278 | end
|
256 | 279 | end
|
257 | 280 |
|
258 |
| - not_compliant_on :browser => [:iphone, :android, :phantomjs] do |
| 281 | + # Microsoft Edge does not return javascriptEnabled when passed in as desired capabilities |
| 282 | + not_compliant_on :browser => [:iphone, :android, :phantomjs, :edge] do |
259 | 283 | describe "execute async script" do
|
260 | 284 | before {
|
261 | 285 | driver.manage.timeouts.script_timeout = 0
|
|
0 commit comments