mike_dz
mike_dz

Reputation: 195

How to do scroll on iOS native app with webdriver.io?

I am trying to scroll on iOS native app using webdriver.io framework. I am using this API: browser.touchAction({ action: 'moveTo', x: 1, y: 2 });

getting error: not yet implemented. Is there any other ways to scroll?

Upvotes: 2

Views: 4345

Answers (6)

Harshith Raj
Harshith Raj

Reputation: 20

browser.execute ('mobile:scroll', {direction:down});

Reference: https://appium.readthedocs.io/en/latest/en/commands/mobile-command

Or one more workaround command is there which scrolls to the specified selector.

browser.getLocation (selector);

Selector can be xpath /css selector

Upvotes: 1

Fardhana Firdhause
Fardhana Firdhause

Reputation: 1

browser.touchAction([
  { action: 'press', x: 1000, y: 1000 },
  { action: 'moveTo', x: 1000, y: -10000 },
  'release'
]);

use y = -ve value for scrolling down.

Upvotes: 0

javimuu
javimuu

Reputation: 1859

Use this command to scroll:

client.execute("mobile: scroll", {direction: 'down'})

Upvotes: 2

Devdutta Goyal
Devdutta Goyal

Reputation: 1135

wanna let you know that in built scroll method is deprecated from appium version 1.3+

Now you can use swipe method
browser.swipe([selector][,xoffset][,yoffset][,speed]);

selector is element

xoffset - relative x cordinate

yoffset- relative y coordinate

speed - in ms the operation should be performed

Upvotes: -1

mike_dz
mike_dz

Reputation: 195

Answer:

browser.touchAction([{action: 'press', x: 10, y: firstY}, { action: 'moveTo', x: 10, y: secondY }, 'release'])

Upvotes: 0

Korbin
Korbin

Reputation: 578

I think you are using wrong api point. According to api documentations on webdriver.io website, you should use browser.touchScroll(id,xoffset,yoffset);

you can check it here http://webdriver.io/api/protocol/touchScroll.html#description

Upvotes: 0

Related Questions