watir-webdriver 0.5.7 → 0.5.8

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.
@@ -35,7 +35,7 @@ module Watir
35
35
  # this actually only applies when finding by xpath - browser.text_field(:xpath, "//input[@type='radio']")
36
36
  # we don't need to validate the element if we built the xpath ourselves.
37
37
  validate_element(element) if element
38
- rescue Selenium::WebDriver::Error::NoSuchElementError => wde
38
+ rescue Selenium::WebDriver::Error::NoSuchElementError
39
39
  nil
40
40
  end
41
41
 
@@ -175,7 +175,7 @@ module Watir
175
175
  when :href
176
176
  (href = element.attribute(:href)) && href.strip
177
177
  else
178
- element.attribute(how)
178
+ element.attribute(how.to_s.gsub("_", "-").to_sym)
179
179
  end
180
180
  end
181
181
 
@@ -248,7 +248,7 @@ module Watir
248
248
  return if tag_name && !tag_name_matches?(element.tag_name.downcase, tag_name)
249
249
 
250
250
  element
251
- rescue Selenium::WebDriver::Error::NoSuchElementError => wde
251
+ rescue Selenium::WebDriver::Error::NoSuchElementError
252
252
  nil
253
253
  end
254
254
 
@@ -1,3 +1,3 @@
1
1
  module Watir
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.8"
3
3
  end
@@ -217,6 +217,27 @@ describe Watir::ElementLocator do
217
217
  locate_one(selector).should == elements[1]
218
218
  end
219
219
 
220
+ it "handles data-* attributes with regexp" do
221
+ elements = [
222
+ element(:tag_name => "div", :attributes => { :'data-automation-id' => "foo" }),
223
+ element(:tag_name => "div", :attributes => { :'data-automation-id' => "bar" })
224
+ ]
225
+
226
+ if Watir.prefer_css?
227
+ expect_all(:css, 'div').and_return(elements)
228
+ else
229
+ expect_all(:xpath, ".//div").and_return(elements)
230
+ end
231
+
232
+
233
+ selector = {
234
+ :tag_name => "div",
235
+ :data_automation_id => /bar/
236
+ }
237
+
238
+ locate_one(selector).should == elements[1]
239
+ end
240
+
220
241
  it "handles :label => /regexp/ selector" do
221
242
  label_elements = [
222
243
  element(:tag_name => "label", :text => "foo", :attributes => { :for => "bar"}),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir-webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-04 00:00:00.000000000 Z
12
+ date: 2012-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver