Sha256: 45d0b11887df40ba9eb5bacd5abff1dd9ae3c532d2ee3740e965dd51ca67327b
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
module Kirchhoff module CommonInterface def find selector e = self.find_element(css: selector).tap do Kirchhoff::Logger.call :info, "find #{selector}..." end block_given? ? yield(e) : e rescue Selenium::WebDriver::Error::NoSuchElementError nil end def multi_find selector self.find_elements(css: selector).tap do |e| Kirchhoff::Logger.call :info, "multi find #{selector}..." end end def find_text text e = self.find_element({xpath: "//*[text()[contains(.,\"#{text}\")]]"}).tap do Kirchhoff::Logger.call :info, "find text '#{text}'..." end block_given? ? yield(e) : e rescue Selenium::WebDriver::Error::NoSuchElementError nil end def multi_find_text text self.find_elements({xpath: "//*[text()[contains(.,\"#{text}\")]]"}).tap do |e| Kirchhoff::Logger.call :info, "multi find text '#{text}'..." end end def to_html attribute "outerHTML" end def to_nokogiri Nokogiri::HTML self.to_html end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kirchhoff-0.0.2 | lib/kirchhoff/common_interface.rb |
kirchhoff-0.0.1 | lib/kirchhoff/common_interface.rb |