How to use @WithTimeout() annotation?

I have a class of elements like this:

public class MainView {

public MainView(AppiumDriver driver) {
    initElements(new AppiumFieldDecorator(driver), this);
}

@WithTimeout(time = 15, chronoUnit = SECONDS)

@iOSXCUITFindBy(accessibility = "foo")
@AndroidFindBy(accessibility = "get started")
private MobileElement getStartedButton;

@iOSXCUITFindBy(accessibility = "login")
@AndroidFindBy(accessibility = "log in")
public MobileElement loginButton;

}

I mentioned that it will be applied for the 1st getStartedButton element only,
but not for the 2nd loginButton.
Do I need to place it by each element above to apply it?

Thank you!

by each. other approach you can change search time using page init before:

PageFactory.initElements(new AppiumFieldDecorator(driver, Duration.ofSeconds(sec)), this); // sec is some value
1 Like