28601

Issue with scroll down in android Appium WebDriver

Question:

How can I scroll down for the element appearance in Appium WebDriver? We are using an emulator for automation.

Any suggestions/help would be appreciated.

Answer1:

This works

TouchAction action = new TouchAction(androidDriver); action.press(0, 500) .waitAction(200) .moveTo(0, 200) .release() .perform();

Just play with the coordinates to get the desidered swiping.

Answer2:

For that you can use scrollToExact() or scrollTo() functions of the <strong>AppiumDriver</strong>

AppiumDriver driver = new AppiumDriver();

to scroll when string contains "abc"

driver.scrollTo("abc");

or for exact string "abc" appear you can use

driver.scrollToExact("abc");

Answer3:

You can use

driver.scrollTo(value);

or

driver.swipe(start.x, start.y, end.x, end.y, duration)

For reference : <a href="http://appium.io/slate/en/0.18.x/?ruby#automating-mobile-gestures" rel="nofollow">http://appium.io/slate/en/0.18.x/?ruby#automating-mobile-gestures</a>

Answer4:

Since scrollTo() and many more related methods are deprecated now with the latest version of appium(1.6.3). You can try the below line of code. It worked for me, hope it works for you as well......you can change the dimension as per your requirements.

Dimension dimensions = driver.manage().window().getSize(); //System.out.println("Dimension value = "+dimensions); Double screenHeightStart = dimensions.getHeight() * 0.5; //System.out.println("Screen Height start Value="+screenHeightStart); int scrollStart = screenHeightStart.intValue(); //System.out.println("Scroll Start Value="+scrollStart); Double screenHeightEnd = dimensions.getHeight() * 0.2; // System.out.println("Screen Height start End="+screenHeightEnd); int scrollEnd = screenHeightEnd.intValue(); //System.out.println("Scroll end Value="+scrollEnd); driver.swipe(0,scrollStart,0,scrollEnd,2000); sleep(3000);

Answer5:

Try using the below code to scroll till bottom: -

Dimension size= driver.manage().window().getSize(); int starty=(int)(size.height*0.80); int endy=(int)(size.height*0.20); int startx=size.width/2; driver.swipe(startx, starty, startx, endy, 3000);

Recommend

  • prism null exception on Container.Resolve()
  • ASP.NET How to Maintain Scroll Position within a Datagrid After Postback
  • Cordova android - Keyboard covering input fields
  • Jump through search results in UIWebView with Javascript
  • Jquery Slider Timer
  • How do I add a HTML hash link without it altering the URL bar…?
  • Fancybox force scroll to top
  • JQUERY, scrollTo, after scrolling down, the page won't let me scroll up for a second… Y?
  • set Focus on Top of screen jquery
  • Using JQuery how do I get the vertical space above an element on the page?
  • Infinite Scroll Effect with javascript
  • Scroll Down [GeckoFx + Javascript]
  • Android Espresso error on button click
  • Android: Notification action to dismiss the notification
  • Removing multiple recurring text from pandas rows`
  • Selenium python unable to scroll down
  • iOS6 JavaScript touchmove event pass through vertical scroll afterwards jQuery animate does not fire
  • jQueryUI sortable and draggable target won't scroll horizontally for drop but will for sort
  • No error while instantiating abstract class, even though abstract method is not implemented
  • Swipe Gesture Recognizer not working for me
  • Android application not restoring state when installed from .apk, works fine from eclipse
  • Using extern @class in order to add a category?
  • Replace and retrieve placeholder value
  • Getting error java.io.FileNotFoundException (log4j log file) at the time of publish project on cloud
  • Python cosine function precision [duplicate]
  • HttpClient: disabling chunked encoding
  • Setting the run time properties on SpringApplicationBuilder()
  • Trying to get the char code of ENTER key
  • output of program is not same as passed argument
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Statically linking a C++ library to a C# process using CLI or any other way
  • Why winpcap requires both .lib and .dll to run?
  • AT Commands to Send SMS not working in Windows 8.1
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • python regex in pyparsing
  • Android Google Maps API OnLocationChanged only called once
  • apache spark aggregate function using min value
  • Sorting a 2D array using the second column C++
  • How can I use threading to 'tick' a timer to be accessed by other threads?