Sha256: 682b81ad28317b736ea787645a9bce81662a0c4a5fceb290a6ea6ace09091c4c

Contents?: true

Size: 921 Bytes

Versions: 6

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

module Webdrone
  class Browser
    def html
      @html ||= Html.new self
    end
  end

  class Html
    attr_reader :a0

    def initialize(a0)
      @a0 = a0
    end

    def find_html(text, n: 1, all: false, visible: true, scroll: false, parent: a0.conf.parent)
      item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, scroll: scroll, parent: parent
      if item.is_a? Array
        item.collect { |x| x.attribute 'innerHTML' }
      else
        item.attribute 'innerHTML'
      end
    rescue StandardError => error
      Webdrone.report_error(@a0, error)
    end

    alias_method :id,     :find_html
    alias_method :css,    :find_html
    alias_method :link,   :find_html
    alias_method :button, :find_html
    alias_method :on,     :find_html
    alias_method :option, :find_html
    alias_method :xpath,  :find_html

    protected :find_html
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
webdrone-1.18.2 lib/webdrone/html.rb
webdrone-1.18.0 lib/webdrone/html.rb
webdrone-1.16.2 lib/webdrone/html.rb
webdrone-1.16.0 lib/webdrone/html.rb
webdrone-1.14.0 lib/webdrone/html.rb
webdrone-1.12.0 lib/webdrone/html.rb