Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature implementation of Issue#9549
Description
Update
PageFactory
methods signature fromWebDriver
toSearchContext
.Currently:
With changes:
No further changes would be needed as upstream classes already use
SearchContext
as type instead ofWebDriver
My current concern is about
instantiatePage
change. Currently Selenium tries to instantiate the page with 2 different constructors (WebDriver
arg and parameterless), I am wondering if there should be a third forSearchContext
between the two existing ones, and if it would be useful.Motivation and Context
Allow elements to be passed as an argument to
PageFactory#initElements
methods and be used as theSearchContext
.My objective here is to solve issues related to shadow doms and elements lookup.
I currently have this changed implemented on my project which has a lot of shadow DOMs on the page, and being able to provide the shadow element to
initElements
allows me to usePageFactory
with the shadow element as the search context, providing WebDriver would never work as the elements are "hidden" inside the shadow DOM.Types of changes
Checklist