[英]UIAutomation is it possible to get elements name using x and y cordinates
Currently i am trying to create a 'soak test' for my iPhone app. 目前,我正在尝试为我的iPhone应用程序创建“浸泡测试”。 i am randomly tapping at set x and y co ordinates.
我随机点击x和y坐标。 Is it possible to find the element that i am tapping?
是否可以找到我正在点击的元素?
any ideas would be great 任何想法都会很棒
Dan 担
我头顶上有人谈论“猴子”,这显然是针对Android进行的,也许与Google相关的“猴子替代品”或“猴子Ios”
Storing your elements in a dictionary and use the coordinates as a key would be a possibility. 将元素存储在字典中并将坐标用作键是可能的。
NSString *key = [NSString stringWithFormat:@"%f%f", tap.Xcoordinate, tap.YCoordinate];
[dictionary objectForKey: key];
You can do it this way iterate through all the subviews in the view and check the intersection point using CGRectInsect function. 您可以通过这种方式遍历视图中的所有子视图,并使用CGRectInsect函数检查相交点。 It returns a bool and then you can get that object.
它返回一个布尔值,然后您可以获取该对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.