-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Introduction of abstraction around @FindBy annotations and PageFactory #3680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
First off, my sincere apologies this took so long. Inexcusable. I've had a quick scan, and this looks good. A couple of questions: 1/ Why move all the logic out of 2/ The original idea with the |
|
I didn't think FieldDecorators? I'm not sure what that is. I think end-users wanted to be able to call a single PageFactory.initElements() and have all of the supplied @findxxx fields and all of the third-party |
|
The It seems that this is neither obvious nor easy to extend, which is why most of the requests we get are around improving the default behaviour. At least your PR moves that forward a little, which is a Good Thing. Frankly, the whole |
|
Merging this in, though I think that |
|
Thanks, @paul-hammant! Merged as 0b30188 |
|
:) |
This change adds an abstract extensible element which provide an 'out-of-the-box' way for users to define custom containerized element groupings, or singular elements with specific behaviors. The design uses only classes instead of interfaces with implementing classes to keep usage simplistic and allows for future annotations to enable context specific overriding. The change should be backwards compatible. Potentially addresses comment in SeleniumHQ#3680 SeleniumHQ#3680 (comment)
Xin the preceding checkbox, I verify that I have signed the Contributor License AgreementSee the discussion of dev list "Extending @findby" (Mar 4th)
Talking through the diff:
AbstractFindByBuilder.java is new. It is really just the migration of methods from AbstractAnnotations.java though.
@annotations are not allowed to have parent annotations, interfaces or classes. That could change in Java10, as it seems arbitrary. Thus there's a new @PageFactoryFinder annotation that each implements now, and that one names a helper class that does the factory business. Of the pre-existing FindBys, each now has such a helper class (as a static inner class for no reason other than co-locating associated code).
Previous tests still pass, plus there's a test for a simulated/contrived alien @findby annotation.
In my opinion, this is OK to slot into a point revision of Selenium as it doesn't break backwards compatibility.