Sha256: f642800c2d104c1513ce16b70c958df91683291ec2e7831297d1883f208be2fa

Contents?: true

Size: 839 Bytes

Versions: 4

Compression:

Stored size: 839 Bytes

Contents

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

  class Html
    attr_accessor :a0

    def initialize(a0)
      @a0 = a0
    end

    def find_html(text, n: 1, all: false, visible: true)
      item = @a0.find.send __callee__, text, n: n, all: all, visible: visible
      if item.is_a? Array
        item.collect { |x| x.attribute 'innerHTML'}
      else
        item.attribute 'innerHTML'
      end
    rescue => exception
      Webdrone.report_error(@a0, exception, Kernel.caller_locations)
    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

4 entries across 4 versions & 1 rubygems

Version Path
webdrone-1.0.4 lib/webdrone/html.rb
webdrone-1.0.0 lib/webdrone/html.rb
webdrone-0.9.9 lib/webdrone/html.rb
webdrone-0.9.8 lib/webdrone/html.rb