@FindBy(how = How.XPATH, using= ".//*[@class='leaflet-control-pan leaflet-control']")
private WebElement movingPageButtonsLocator;
Will match any XPATH query, which can be anything on the page. Where className is a single class on an element if you want to match multiple classes on an element you need to use @FindBys.
According to the JavaDoc, this is how it should be:
@FindBys({@FindBy(how = How.CLASS_NAME, using= "leaflet-control-pan"),
@FindBy(how = How.CLASS_NAME, using= "leaflet-control") })
private WebElement movingPageButtonsLocator;
or more succinctly:
@FindBys({@FindBy(className = "leaflet-control-pan"),
@FindBy(className = "leaflet-control") })
private WebElement movingPageButtonsLocator;
@FindBys is a logical AND it will only find where both class are on an element. I think it should have been called @FindByAll to be semantically correct
Used to mark a field on a Page Object to indicate that lookup should
use a series of @FindBy tags in a chain as described in ByChained
@FindAll is a logical OR it find where any of the specified criteria match an element. I think it should have been called @FindByAny to be semantically correct
Used to mark a field on a Page Object to indicate that lookup should
use a series of @FindBy tags It will then search for all elements that
match any of the FindBy criteria. Note that elements are not
guaranteed to be in document order.
XPATHand matches anyXPATHquery, the other is something else, no where in the documentation does it suggest that they are equal in any way.