Open robingustafsson opened 2 years ago
I checked out the Playwright Locator API and its underlying code. It seems like we need to do this for every ElementHandle action, etc. It looks involved.
Maybe we should separate this issue into sub-issues and handle the main issue together?
Could you also check out the PW docs and tell me WDYT, @imiric?
Yeah, this seems more involved than I originally thought. We should definitely split it up somehow. Let's discuss it tomorrow.
We don't have to finish everything for v0.3.0, and we likely won't have time to, but we can release it gradually. It should be easier once we lay the groundwork and start ticking off each method.
My findings on this feature are in the description. I'll start working on this next week as there is some stuff that I'm trying to figure out.
TODO
I'm noticing a lot of repetitions.
strict_link.html
to locator.html
when I'm done.~
We started the development of the first version on May 16th.
Strict forwarders (milestone: v0.7.0)
Strict forwarders (milestone: v0.4.0)
The locator methods that forward calls to the
Frame
methods with the strict mode on (meaning: only select a single element).Just-in-time element finder methods
The locator methods wrap around existing
ElementHandle
methods. For example:_withElement
queries the element usingwaitForSelector
in the current frame and returns a disposed element handle:Locator-specific methods
Allows users to move between the selected element.
Blocked (milestone: unknown)
Explanation
Add support for
Locator
, a way to capture a pointer to DOM element(s) without attaching to an actual DOM node asElementHandle
does. Sort of a just-in-time version of querying the DOM and getting anElementHandle
back to do actions on.Relevant links:
Below are the May 11th, 2022, findings for this feature.
Summary
The whole idea of locators is that you can carry on selectors with you—without dealing with actual elements. Locators enable the Page Object Model for reducing code duplication and improving test maintenance.
A locator is created with a selector for a specific frame. When you invoke one of the Locator methods, they query the frame and run the action. Since they query the frame, each call can resolve to a different DOM element.
Benefits:
Good explanation of the strict mode and locators API:
Key knowledge