Just installed appium 1.6.4 and updated all other apps with brew and npm.
Using real device with iOS 10.3.1, with latest C# appium / selenium drivers.
The product under test has pages with several buttons, all of which are enabled but only one of them is visible depending on the scenario. For Appium 1.6.3 and earlier I could do driver.FindElement(…) with an xPath “//XCUIElementTypeButton[@name=‘button1’ and visible=‘true’]” to make sure I could find the one that was visible.
This no longer works. I have to remove the “and visible=‘true’” part go get the .FindElement to work. Without that though, the .FindElement finds all of them, not just the visible one.
In our c# code, the IWebElement has a .Displayed property, which I can use and this does return the correct information. So it appears Appium can detect whether an element is visible or not. So how come this got removed and not backwards compatible.
Yeah, I have a workaround. It means lots of changes and extra query time, which is already slow.
Is there any way to construct more sophisticated queries. How to alter such kind of xpath:
//XCUIElementTypeOther[XCUIElementTypeStaticText[@name='id_from_label']]/following-sibling:: XCUIElementTypeOther[XCUIElementTypeOther[@visible='true' and @name='XYZ']]
with predicate ?
Sometimes if application’s objects dont have unique IDs then its hard to locate elements and thats why I have to use such complex xpath queries.
private final String allCategoryEntriesSelector = "//XCUIElementTypeOther[3]/XCUIElementTypeTable";
private final By allVisibleCategories = xpath(allCategoryEntriesSelector + "[@visible='true']");
It doesn’t work anymore. Maybe you have a solution for me?