How to Scroll Up/Down in Andriod Appium using wd driver using Javascript-nodejs?

I am trying to automate an Android APP where I need to scroll down/up the screen using the wd driver using Javascript(NodeJS Automated Testing with WD.js)

I tried using the below locators and it didn't work

await driver.scroll(100, 200);
//await driver.execute('mobile: scroll', {direction: 'down'});
//await  driver.execute("mobile: scroll", [{ direction: 'down' }])

I am getting the below error:

Error: [scroll(100,200)] Error response status: 13, UnknownError - An unknown server-side error occurred while processing the command. Selenium error: An unknown server-side error occurred while processing the command. Original error: com.jayway.jsonpath.InvalidPathException: invalid path.

Appreciate your inputs and help on this.

Answers:

Answer

I had similar issues, so I just made use of TouchAction that is part of the wd driver:

var touchAction = new wd.TouchAction(global.driver)
  .longPress({ x: 0, y: 1000 })
  .moveTo({ x: 0, y: 10 })
  .release();
await touchAction.perform();

In the case of 'global.driver' just put the instance of wd that you have.

This works for me for simple scrolling from an absolute point on screen to another.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.