Why are UIAElement's children not equal to themselves?

社会主义新天地 提交于 2019-12-04 12:42:27

Not sure if this helps, but can you try === operator to compare the objects?

take a look at tuneup.js (http://www.tuneupjs.org/). This library makes iOS UIAutomation a lot more pleasant. One thing it does is extend the functionality of UIAElements, using tuneup the above line in your code would be

var equals = (el1.equals(el2));

Braains

This is actually a known bug in the UIAutomation software. The workaround that I've come up with is to test based on all the available properties of an element. It's a real pain in the butt.

 var el1 = ELEMENT_1;

 var el1x = el1.rect().origin.x;
 var el1y = el1.rect().origin.y;
 var el1w = el1.rect().size.width;
 var el1h = el1.rect().size.height;
 var el1n = el1.name();

 var el2 = ELEMENT_2;

 var el2x = el2.rect().origin.x;
 var el2y = el2.rect().origin.y;
 var el2w = el2.rect().size.width;
 var el2h = el2.rect().size.height;
 var el2n = el2.name();

 if(el1x == el2x && el1y == el2y &&
      el1w == el2w && el1h == el2h &&
      el1n == el2n)
 {
      // Elements are equal
      return true;
 }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!