With Java Client > 1.6.0 (https://github.com/appium/java-client/pull/68), elements can be located with Annotations.
I personally love annotations but I am not 100% sure if they are suitable for my use case. I test Android and iOS native apps (clicking trough different views/screens and checking asserts). Currently, I search for the elements by
WebElement elem = driver.findElement(By.id(resourceID));
Now, I can also search for the elements with Annotations
public class MyClass {
@AndroidFindBy(id="signUpButton")
WebElement signUpButton;
protected void someMethod() {
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
signUpButton.click();
.....
}
I assume that the Annotations are more useful when testing static pages/ views which do not change often? When clicking trough an app (like I do), I would always have to call the initElements method when switching between screens/views.
Or are those Annotations also meant to be used for usecases I described?
See also https://groups.google.com/forum/#!topic/appium-discuss/dXD2bUYW6ag70
created
Sep '14
last reply
Sep '18
- 12
replies
- 8.3k
views
- 7
users
- 10
likes
- 3
links