Sha256: ce9c6b44c53c3d42bf07892e4840fa18bc6ee45cd2a622b1a71a03fd0686b0cb

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

module Watir
  class Element
    attr_reader :doc

    #
    # Store instance of Nokogiri
    #

    def doc=(html)
      @doc = html
      return if html.nil?

      @reset_doc_hook = ->(element) { element.reset_doc }
      browser.after_hooks.add(@reset_doc_hook)
    end

    def reset_doc
      @doc = nil
      browser.after_hooks.delete(@reset_doc_hook)
    end

    #
    # TODO - reimplement with Watir Executor when available
    #
    # Uses Nokogiri to return the text of the element.
    #
    # @return [String]
    #

    def text!
      @selector[:nokogiri] = true
      text.strip
    end

    alias el_stale? stale?
    def stale?
      @doc.nil? && el_stale?
    end
  end # Element
end # Watir

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
watigiri-0.6.3 lib/extensions/watir/element.rb
watigiri-0.6.2 lib/extensions/watir/element.rb
watigiri-0.6.1 lib/extensions/watir/element.rb
watigiri-0.6.0 lib/extensions/watir/element.rb
watigiri-0.5.0 lib/extensions/watir/element.rb