Sha256: 9fbc593f4d1715dffe918bc3a489c7c09109ae4ddccf343e0c3b65c0845cc47f

Contents?: true

Size: 1.91 KB

Versions: 5

Compression:

Stored size: 1.91 KB

Contents

module Appium
  module Android

    # Find the first element containing value
    # @param value [String] the value to search for
    # @return [Element]
    def find value
      complex_find_contains '*', value
    end

    # Find all elements containing value
    # @param value [String] the value to search for
    # @return [Array<Element>]
    def finds value
      complex_finds_contains '*', value
    end

    # Find the first element exactly matching value
    # @param value [String] the value to search for
    # @return [Element]
    def find_exact value
      complex_find_exact '*', value
    end

    # Find all elements exactly matching value
    # @param value [String] the value to search for
    # @return [Array<Element>]
    def finds_exact value
      complex_finds_exact '*', value
    end

    # @private
     def scroll_uiselector content
       "new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(#{content}.instance(0));"
     end

    # Scroll to the first element containing target text or description.
    # @param text [String] the text to search for in the text value and content description
    # @return [Element] the element scrolled to
    def scroll_to text
      text = %Q("#{text}")

      args = scroll_uiselector("new UiSelector().textContains(#{text})") +
             scroll_uiselector("new UiSelector().descriptionContains(#{text})")

      find_element :uiautomator, args
    end

    # Scroll to the first element with the exact target text or description.
    # @param text [String] the text to search for in the text value and content description
    # @return [Element] the element scrolled to
    def scroll_to_exact text
      text = %Q("#{text}")

      args = scroll_uiselector("new UiSelector().text(#{text})") +
             scroll_uiselector("new UiSelector().description(#{text})")

      find_element :uiautomator, args
    end
  end # module Android
end # module Appium

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
appium_lib-6.0.0 lib/appium_lib/android/element/generic.rb
appium_lib-5.0.1 lib/appium_lib/android/element/generic.rb
appium_lib-5.0.0 lib/appium_lib/android/element/generic.rb
appium_lib-4.1.0 lib/appium_lib/android/element/generic.rb
appium_lib-4.0.0 lib/appium_lib/android/element/generic.rb