Rahul Kumar
Rahul Kumar

Reputation: 59

ios uiAutomation tapWithOptions not working properly

I have to run UIAutomation for touch and hold.. I am using tapWithoptions(offset,duration)..but the problem is i want to vary the cordinates on which it will tap..but thats not happening..its always taking center cordinate for some weird reason.

The same command works properly if i remove the duration parameter..but i want duration in it..following is the line i am using for it:-

target.frontMostApp().mainWindow().scrollViews()[0].scrollViews()[0].tapWithOptions({tapOffset:{x:xPos, y:yPos},duration:1.2});

Any help in this regard shall be highly appreciated

Upvotes: 0

Views: 807

Answers (2)

rakeshNS
rakeshNS

Reputation: 4257

I had almost same issue. You ca try target.frontMostApp().mainWindow().scrollViews()[0].scrollViews()[0].tapWithOptions({x: 27.0, y: 949.0}, {duration:3});

If you see the documentation, tapOffset is not the exact x and y positions. It is just relatives values between 0 and 1. You have to calculate these relative values according to x, y positions.

Upvotes: 2

Sulthan
Sulthan

Reputation: 130102

Tapping scrollviews is not working very well with UI Automation. The best solution is to recalculate the position into window position and tap mainWindow.

Upvotes: 0

Related Questions