I like to use PageFactory with FindBy annotations in my automation framework to autolocate elements in my page object classes.
I have one WebElement for which I need to be able to specify a couple of different locators. I thought FindBys was my solution, but apparently that is not how it works. It's the equivalent of driver.findElement(option1).findelement.(option2). That's not what I need. I need something that will find an element by one or the other locators. If one doesn't work, then use the other locator. Is there a way to do this in Selenium using FindBy annotations?
Best Answer
There is apparently a new feature in Selenium as of May this year -- the @FindAll annotation that does exactly what I need;
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/support/FindAll.html http://selenium.10932.n7.nabble.com/Pull-Request-62-Add-a-FindAll-annotation-to-the-Java-Page-Factory-td24814.html