Sha256: 183bc574f06575de91fef147de789e51756a4d1401c36b009985d7649c9fca06

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

module Webdrone
  class Browser
    def text
      @text ||= Text.new self
    end
  end

  class Text
    attr_accessor :a0

    def initialize(a0)
      @a0 = a0
    end

    def text(text, n: 1, all: false, visible: true, parent: nil)
      item = @a0.find.send __callee__, text, n: n, all: all, visible: visible, parent: parent
      if item.is_a? Array
        item.collect(&:text)
      else
        item.text
      end
    rescue => exception
      Webdrone.report_error(@a0, exception)
    end

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

    def page_title
      @a0.driver.title
    rescue => exception
      Webdrone.report_error(@a0, exception)
    end

    protected :text
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webdrone-1.7.0 lib/webdrone/text.rb