I have no experience with iOS, but I am trying to redesign my Android Project for the iOS Guys to use it as well for iOS.
After search in internet I find out that this can happens by using the page factory and locating elements by @iOSFindBy, After trying to use @iOSFindby for locating element using the page factory method, the compiler indicate that it is deprecated.
@iOSFindBy (Accessibility = "button_login")
@AndroidFindBy(id = "net.myApp.int:id/loginBtn")
private MobileElement login_Button2;
what Can I use instead of this?
I saw also in Appium java client (https://static.javadoc.io/io.appium/java-client/7.0.0/index.html?deprecated-list.html) :
*io.appium.java_client.pagefactory Annotation Type iOSFindBy Deprecated. UIAutomation is going to get deprecated. Use iOSXCUITFindBy instead It is recommended to use XCUITest
@Retention(value=RUNTIME) @Target(value={FIELD,TYPE}) @Repeatable(value=iOSFindBySet.class) public @interface iOSFindBy
Used to mark a field on a Page Object to indicate an alternative mechanism for locating the element or a list of elements. Used in conjunction with PageFactory this allows users to quickly and easily create PageObjects. using iOS UI selectors, accessibility, id, name, class name, tag and xpath*
but I dont know if this is the solution and how to use If I use it in my Code also get Error:
@iOSXCUITFindBy Accessibility = "button_login"
@AndroidFindBy(id = "net.myApp.int:id/loginBtn")
private MobileElement login_Button1;
Annotation are not allowed here.
Thanks for any Tip in advance
The best way to know how things work is to check related tests in appium-java-client repository on github:
@iOSXCUITFindBy(accessibility = "IntegerB")
private MobileElement textField2;
So in your case, it should be:
@iOSXCUITFindBy(accessibility = "button_login")
@AndroidFindBy(id = "net.myApp.int:id/loginBtn")
private MobileElement login_Button1;