Scroll in Android using Appium

Let’s see, How can you scroll in Android using Appium. In previous tutorials, You have seen, How can perform Swipe horizontal & vertical in Android. Now we will see, How can we Scroll for specific Text.

 

Most of Android Applications contain list view and you need to scroll down to select specific element.

For this, You can use scrollTo(String text) method of IOSElement class If you want to scroll down till specific text in Appium software automation test.

Let’s try to Implement It practically in Android Automation Test to know how scrollTo(String text) method works.

 

Scroll in Android

Suppose we have in Application, Where we need to insert our Country name in some field. So in this way, We need to scroll the List, Until we find our country name. For this, the steps should be like this –

  • First, we will open Andriod App,
  • Tap on “Country” field.
  • On next screen, Scroll down till element which contains the text “Your country Name”.
  • And tap on an element which contains the text “Your  Country Name”.

 

In the above Test example, We have used the driver.scrollTo(String text) methods for scrolling. It will scroll down steps by step and look If given text Is displayed on the screen or not. When text appears, It will stop scrolling.

 

  • First driver.scrollTo(“India”); will check if element containing test “India” is displayed on the screen or not. If not display then It will scroll down and check for text once again.

 

You can use above code for your reference Application and Test it on your local machine.

0 Comment

Leave a Reply