How to scroll the page(web view) in mobile browsers using Appium(Android)


I have a requirement to run the scripts on mobile and web browsers. I am using the appium to run the scripts in mobile browsers in android phones, but i am unable to scroll the page using swipe methods.

Please help me to resolve this issue.

Appium Version : 1.7.1
Appium Java-Client : 4.1.2
Selenium: 2.53

Hi !
look this !
public void scrollElementoWeb(def params){

    MobileElement element = Elementos.find(params, Driver.driver);
    JavascriptExecutor js = (JavascriptExecutor) Driver.driver;
        int x = element.getLocation().getX();
        int y = element.getLocation().getY();
        js.executeScript("window.scrollBy(" + x + "," + y + ")", "");
    }catch(Exception e){
        }catch(Exception f){
            assert false,"No se pudo realizar scroll en la pagina web en el elemento ${params."Tipo ID"}:'${params.ID}'. ${f}"

try running this script ! this is groovy but the js functions is the key! :wink:

1 Like