Sha256: 310ffc77e66a9d30377b98755465bafe64dcb52a25688e63beed431566d8e533

Contents?: true

Size: 608 Bytes

Versions: 4

Compression:

Stored size: 608 Bytes

Contents

# encoding: utf-8
module Watir
  module XpathSupport
    include Selenium

    def element_by_xpath(xpath)
      e = wd.find_element(:xpath, xpath)
      Watir.element_class_for(e.tag_name).new(self, :element, e)
    rescue WebDriver::Error::WebDriverError
      BaseElement.new(self, :xpath, xpath)
    end

    def elements_by_xpath(xpath)
      # TODO: find the correct element class
      wd.find_elements(:xpath, xpath).map do |e|
        Watir.element_class_for(e.tag_name).new(self, :element, e)
      end
    rescue WebDriver::Error::WebDriverError
      []
    end

  end # XpathSupport
end # Watir

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
watir-webdriver-0.0.1.dev4 lib/watir-webdriver/xpath_support.rb
watir-webdriver-0.0.1.dev3 lib/watir-webdriver/xpath_support.rb
watir-webdriver-0.0.1.dev2 lib/watir-webdriver/xpath_support.rb
watir-webdriver-0.0.1.dev lib/watir-webdriver/xpath_support.rb