2

I am using appium and webdriverIO to automate android native app. I need to perform scroll down and i have used

ele.scrollIntoView(true) //this returns not yet implemented error

is there any other way to scroll down?

3 Answers 3

1

I don't used java script to scroll down. but I have already given a detail answer with different approach (by some text, element and screen size). Please have a look on it.

How to reach the end of a scroll bar in appium?

Hope it will help.

Sign up to request clarification or add additional context in comments.

2 Comments

Using UiScrollable is great approach.
Yes. its very helpful too.
1

I have find a way to perform swipe down by calling JsonWireProtocol api directly from my code. https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol

here is my code

module.exports.scrollAndroid = function (ele) {
    console.log('driver.sessionID = ', driver.sessionId);
    while (!$(ele).isDisplayed()) { . //$(ele)=$(//xpath or any other attribute)
        this.scrollAPICall();
        driver.pause(3000);
    }

};
module.exports.scrollAPICall = function () {
    var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        console.log("result status >> ", this.status);
        console.log("result text >> ", this.responseText);
    };

    url1 = `http://127.0.0.1:4723/wd/hub/session/${driver.sessionId}/touch/flick`;
    xhttp.open('POST', url1);
    console.log("URL >> ", url1)
    xhttp.setRequestHeader("Content-Type", "application/json");
    xhttp.setRequestHeader("charset", "UTF-8");
    xhttp.send(JSON.stringify({
        xspeed: 10,
        yspeed: -100,
    }));

if you want to scroll up then give yspeed as + value. ex:100

1 Comment

Why so much headache when appium library is giving readymade function to handle it?
-1

You can achieve a scroll down by performing a Screen Swipe Up action. Implementation of swipe class can be found from Boilerplate project. The Gestures.js class has all required functions. Here is the link to class

Please keep in mind that the swipe is performed based on the percentage. Once you implement this Gestures class you can then use it like below:

while(!element.isDisplayed()) {
      Gestures.swipeUp(0.5)
}

1 Comment

updated link to the Gestures.ts file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.