How can I select objects, that don't have a specified child? For example, I need to find objects, that don't have resource-id "btn-add-remove", in example below is container[2].
MobileObject[@resource-id='container']
MobileObject[@resource-id='cardView']
MobileObject[@resource-id='btn-add-remove']
MobileObject[@resource-id='tv_menu_title']
MobileObject[@resource-id='container'][2]
MobileObject[@resource-id='cardView']
MobileObject[@resource-id='btn-add-remove']
MobileObject[@resource-id='tv_menu_title']
The Xpath that I have tried are
- MobileObject[@resource-id='cardView or @resource-id='tv_menu_title' and not @resource-id!='btn-add-remove']/ancestor::MobileObject[@resource-id='container']
- MobileObject[@resource-id='container']//MobileObject[@resource-id='cardView or @resource-id='tv_menu_title' and not @resource-id!='btn-add-remove']
both resulted in container1