Appium 1.6.4 removed "visible" attribute. xPath queries failing

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.

I had to do the same thing with my iOS tests. I believe it’s a limitation of XCUITest now.

Its been suggested that I search by predicates as that still supports visible attribute.

type == ‘XCUIElementTypeButton’ AND name == ‘button1’ AND visible == 1

Is there any c# example of this using driver.FindElementBy…(…)

            IWebElement node = driver.FindElement("-ios predicate string", "type=='XCUIElementTypeStaticText' AND name=='Update available' AND visible==1");

This is working for me.

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.

i have a problem with the @visible attribute too. My method is like:

public UiCategorySearchFilterData getVisibleCategoryAtPosition(int position) {
WebElement category = getElementFromList(allVisibleCategories, position);
return fetchCategoryData(category);
}

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?