I want to scroll to a particular text in android app and click on it.
Currently, it is scrolling up/down but it is unable to find the given text. I am working with ‘appium_lib’ for Ruby, Android (Yelp application). Below is the code snippet:
it ‘Should launch’ do
begin
find_element(:name, ‘More Categories’).click
el = scroll_to(‘Food’)
el.find_element(:xpath, “//android.widget.CheckedTextView[@text=‘Food’ and @index=‘0’]”).click
rescue Exception => error
p error.message
end
end
def scroll_to text
# This is a workaround for Appium issue 4311,
# It can and should be replaced by the following when the issue is resolved
# appium.driver.scroll_to text
text = %Q(“#{text}”)
args = Appium::Android::scroll_uiselector(“new UiSelector().text(#{text})”)
find_element :uiautomator, args
end