Issue
I like to use PageFactory
with @FindBy
annotations in my automation framework to auto-locate 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?
Solution
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
Answered By - Selena
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.