Sha256: 162c2baa6c4c359fd146620e0b7c441e57071adffab1669624c9954de40ab8b7

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

module TestaAppiumDriver
  #noinspection RubyYardReturnMatch
  class Locator


    #noinspection RubyNilAnalysis
    def attribute(name, *args)
      elements = execute(*args)

      if elements.instance_of?(Selenium::WebDriver::Element)
        r = elements.send(:attribute, name.to_s)
        r = TestaAppiumDriver::Bounds.from_ios(r, @driver) if name.to_s == "rect"
      else
        r = elements.map { |e| e.send(:attribute, name.to_s) }
        r.map! { |b| TestaAppiumDriver::Bounds.from_ios(b, @driver) } if name.to_s == "rect"
      end
      r
    end


    def accessibility_container(*args)
      attribute("accessibilityContainer", *args)
    end

    def accessible?(*args)
      attribute("accessible", *args).to_s == "true"
    end


    def class_name(*args)
      attribute("class", *args)
    end

    def enabled?(*args)
      attribute("enabled", *args).to_s == "true"
    end

    def frame(*args)
      attribute("frame", *args)
    end

    def index(*args)
      attribute("index", *args)
    end

    def label(*args)
      attribute("label", *args)
    end

    def name(*args)
      attribute("name", *args)
    end


    def rect(*args)
      attribute("rect", *args)
    end

    def selected?(*args)
      attribute("selected", *args).to_s == "true"
    end

    def type(*args)
      attribute("type", *args)
    end

    def value(*args)
      attribute("value", *args)
    end

    def visible?(*args)
      attribute("visible", *args).to_s == "true"
    end


    alias_method :bounds, :rect
    alias_method :text, :label
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
testa_appium_driver-0.1.2 lib/testa_appium_driver/ios/locator/attributes.rb
testa_appium_driver-0.1.1 lib/testa_appium_driver/ios/locator/attributes.rb
testa_appium_driver-0.1.0 lib/testa_appium_driver/ios/locator/attributes.rb