Sha256: e4338d5b50a55f74c9692ac3871c8247464d5cceb568be3c8799bac33dfef09a

Contents?: true

Size: 1.91 KB

Versions: 18

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 = %("#{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 = %("#{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

18 entries across 18 versions & 1 rubygems

Version Path
appium_lib-9.3.4 lib/appium_lib/android/element/generic.rb
appium_lib-9.3.3 lib/appium_lib/android/element/generic.rb
appium_lib-9.3.2 lib/appium_lib/android/element/generic.rb
appium_lib-9.3.1 lib/appium_lib/android/element/generic.rb
appium_lib-9.3.0 lib/appium_lib/android/element/generic.rb
appium_lib-9.2.0 lib/appium_lib/android/element/generic.rb
appium_lib-9.1.3 lib/appium_lib/android/element/generic.rb
appium_lib-9.1.2 lib/appium_lib/android/element/generic.rb
appium_lib-9.1.1 lib/appium_lib/android/element/generic.rb
appium_lib-9.1.0 lib/appium_lib/android/element/generic.rb
appium_lib-9.0.0 lib/appium_lib/android/element/generic.rb
appium_lib-8.2.1 lib/appium_lib/android/element/generic.rb
appium_lib-8.2.0 lib/appium_lib/android/element/generic.rb
appium_lib-8.1.0 lib/appium_lib/android/element/generic.rb
appium_lib-8.0.2 lib/appium_lib/android/element/generic.rb
appium_lib-8.0.1 lib/appium_lib/android/element/generic.rb
appium_lib-8.0.0 lib/appium_lib/android/element/generic.rb
appium_lib-7.0.0 lib/appium_lib/android/element/generic.rb