Reputation: 31
I am trying to scroll the android screen using touchAction in webdriverio. Am using the following code to perform action but it doesn't work.
driver.touchAction([ {action:'press',x:1052,y:1567}, { action: 'moveTo',x:1041, y:689}, 'release' ])
Any suggestion would be helpful
Upvotes: 1
Views: 2389
Reputation: 1386
Apart from the touchAction
, the touchPerform
can chain operations altogether.
await driver.touchPerform([
{ action: "longPress", options: { x: 414, y: 1285 } },
{ action: "moveTo", options: { x: 427, y: 226 } },
{ action: "release", options: {} },
{
action: "wait",
options: {
ms: 100,
},
},
{ action: "longPress", options: { x: 414, y: 1285 } },
{ action: "moveTo", options: { x: 427, y: 226 } },
{ action: "release", options: {} },
]);
Upvotes: 0
Reputation: 55
Try using longPress
instead of press
. You may also need to preface the command with await
due to to asynchronous nature. For example:
await driver.touchAction([ {action: 'longPress', x: 0, y: 1000}, { action: 'moveTo', x: 0, y: 10}, 'release' ]);
Upvotes: 3