Sha256: 3e5170c05ea9eaa5a3dfd1e4d5234a798a7aab2dcc4b2c5810b0f81a01356a32
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
# encoding: utf-8 module Watir module XpathSupport include Selenium # # Find the first element matching the given XPath # def element_by_xpath(xpath) warn 'element_by_xpath is deprecated and replaced by .element(:xpath, ...)' e = wd.find_element(:xpath, xpath) Watir.element_class_for(e.tag_name.downcase).new(self, :element => e) rescue WebDriver::Error::NoSuchElementError Element.new(self, :xpath => xpath) end # # Find all elements matching the given XPath # def elements_by_xpath(xpath) warn 'elements_by_xpath is deprecated and replaced by .elements(:xpath, ...)' wd.find_elements(:xpath, xpath).map do |e| Watir.element_class_for(e.tag_name.downcase).new(self, :element => e) end end def self.escape(value) if value.include? "'" parts = value.split("'", -1).map { |part| "'#{part}'" } string = parts.join(%{,"'",}) "concat(#{string})" else "'#{value}'" end end end # XpathSupport end # Watir
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
watir-webdriver-0.5.0 | lib/watir-webdriver/xpath_support.rb |
watir-webdriver-0.4.1 | lib/watir-webdriver/xpath_support.rb |
watir-webdriver-0.4.0 | lib/watir-webdriver/xpath_support.rb |