Appium IOS Java-Client PageObjects

So right now we are using the Ruby lib for testing the IOS tablet. We would like to move to the “java-client” because that is what we are using for Android. What i’m trying to do is use “pageObjects” to select both the Class, Name and “hint”. As you can see i have a few elements that have the same Name/Class.

I will be working with the dev to clean that up but that takes time.

https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/pagefactory/iOSFindBy.java

// Here is the current interface. I was hoping it would easy to add “String hint() default “”;” to help find what i’m looking for. // But that does not work.
public @interface iOSFindBy {
String uiAutomator() default “”;
String accessibility() default “”;
String id() default “”;
String name() default “”;
String className() default “”;
String tagName() default “”;
String xpath() default “”;
}

The code i’m using is the following:

@iOSFindAll({
        @iOSFindBy(className = "UIAButton"),
        @iOSFindBy(name = "Refresh")
})
private List<MobileElement> refreshButton;

public void refreshApp() {

    System.out.println("TEST.... Wait...");
    System.out.println("Refresh Objects: " + refreshButton.size());

}

The output is:

TEST… Wait…
0

There are 3 buttons in my view.

{“UIAButton”:{"@":{“name”:“Refresh”,“label”:“Refresh”,“value”:"",“dom”:{“id”:""},“enabled”:true,“valid”:true,“visible”:false,“hint”:"",“path”:"/0/0/1/3/0/2",“x”:1056,“y”:77,“width”:40,“height”:40},">":[]}},

{“UIAButton”:{"@":{“name”:“Refresh”,“label”:“Refresh”,“value”:"",“dom”:{“id”:""},“enabled”:true,“valid”:true,“visible”:true,“hint”:"",“path”:"/0/0/1/16/0/2",“x”:288,“y”:697,“width”:40,“height”:40},">":[]}},

{“UIAButton”:{"@":{“name”:“Refresh”,“label”:“Refresh”,“value”:null,“dom”:null,“enabled”:true,“valid”:true,“visible”:true,“hint”:“Reload dashboard content.”,“path”:"/0/0/2",“x”:73,“y”:992.5,“width”:16,“height”:32},">":[]}},

Ruby Code that works but i want to use java.

def refresh_dashboard_button
  # Make a reference to the Refresh button
  refresh = find_ele_by_attr(:UIAButton, :hint, 'Reload dashboard content.')

  # click the refresh button
  refresh.click
end

Anyone with any thoughts?

Thanks!

J

I am suspecting that something wrong with your locators.
FindByAll is descrided here (examle for Android):

Engines for iOS are same.
Does it find the wrong element? I think it should find some

[quote=“xsmaster, post:1, topic:3226”]
“UIAButton”),
[/quote]. But I am suspecting that it is not expected element.

Find All annotations were designed to avoid the problem when visually the same element has different locators. It depends on conditions like user profile, OS version etc.

Or…
Does it find nothing?