lib/watir-webdriver/locators/element_locator.rb in watir-webdriver-0.5.7 vs lib/watir-webdriver/locators/element_locator.rb in watir-webdriver-0.5.8
- old
+ new
@@ -33,11 +33,11 @@
end
# this actually only applies when finding by xpath - browser.text_field(:xpath, "//input[@type='radio']")
# we don't need to validate the element if we built the xpath ourselves.
validate_element(element) if element
- rescue Selenium::WebDriver::Error::NoSuchElementError => wde
+ rescue Selenium::WebDriver::Error::NoSuchElementError
nil
end
def locate_all
if @selector.size == 1
@@ -173,11 +173,11 @@
when :tag_name
element.tag_name.downcase
when :href
(href = element.attribute(:href)) && href.strip
else
- element.attribute(how)
+ element.attribute(how.to_s.gsub("_", "-").to_sym)
end
end
def matches_selector?(element, selector)
selector.all? do |how, what|
@@ -246,10 +246,10 @@
element = @wd.find_element(:id, id)
return if tag_name && !tag_name_matches?(element.tag_name.downcase, tag_name)
element
- rescue Selenium::WebDriver::Error::NoSuchElementError => wde
+ rescue Selenium::WebDriver::Error::NoSuchElementError
nil
end
def all_elements
@wd.find_elements(:xpath => ".//*")