UIAutomation's dragInsideWithOptions has no ef

2019-01-17 23:27发布

Since I use Xcode 5 and the new iOS 7 simulator to run UIAutomation tests with Instruments, dragInsideWithOptions and dragFromToForDuration functions have simply no effect. (The same tests worked fine with iOS 6.1 simulator.) Is this a known bug, or the usability of this functions has changed? Is there anyone who could use this function with iOS 7 simulator on iPad?

5条回答
够拽才男人
2楼-- · 2019-01-17 23:59

This is a bit old but it seems that dragInsideWithOptions is still not working.

For a UIScrollView these methods can be used:

scrollUp
scrollDown
scrollLeft
scrollRight

Source: https://developer.apple.com/library/prerelease/ios/documentation/ToolsLanguages/Reference/UIAScrollViewClassReference/index.html

Ex:

UIATarget.localTarget().frontMostApp().mainWindow().scrollViews()[0].scrollRight();

Hope it helps!

查看更多
地球回转人心会变
3楼-- · 2019-01-17 23:59

A workaround: if you want to swipe scroll views containing a button on a later page, just simply tap this (invisible) button, it "scrolls to visible" automatic. (Or call this invisible element's scrollToVisible() function.)

查看更多
Lonely孤独者°
4楼-- · 2019-01-18 00:01

Another workaround: If you have a page control associated with your scroll view, use:

pageIndicator = UIATarget.localTarget().frontMostApp().mainWindow().pageIndicators()[0];
pageIndicator.selectPage(1);
查看更多
ゆ 、 Hurt°
5楼-- · 2019-01-18 00:01
女痞
6楼-- · 2019-01-18 00:03

Same issue here. In addition to dragInsideWithOptions not working, dragFromToForDuration and flickFromTo aren't working either in Xcode 5 with iOS 7. I have been searching and waiting for a solution as well. Until then, swiping won't be possible.

查看更多
登录 后发表回答