-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: expose Frame Ids #30261
Comments
@himat ID is an internal implementation detail. You can always create a const idMap = new Map<Frame, number>();
function getFrameId(frame: Frame) {
if (!idMap.has(frame))
idMap.set(frame, idMap.size + 1);
return idMap.get(frame)!;
} |
@dgozman But that relies on only having one instance of a given |
I also noticed that playwright has an internal only |
@himat |
@dgozman, ok so using But I have another usecase, where I need to reach into the CDP to listen for events since playwright does not expose these
As you can see, I want to detect the navigation start for a page, and the RequestWillBeSentEvent gives me back a |
@himat Interoperating with CDP is not a goal for Playwright. The use of CDP is an implementation detail. If you'd like to work with CDP directly, feel free to retrieve the frame tree over CDP and call any protocol methods you'd like. Note that Playwright does not guarantee that it won't break after you call some CDP methods, so use it at your own risk.
Yes, |
Closing as per above. If you encounter more problems, please file a new issue by filling in the "Bug Report" template. |
馃殌 Feature Request
Why does playwright not expose a unique frame ID on the Frame object?
There is a unique ID for every Frame that is exposed in the CDP
So why does Playwright not expose this?
I need a way to distinguish frames and track them across time, so using just the
.name()
property is not sufficient since two frames could have the same name, and the names can change over time.Puppeteer at least has an internal variable _id that you can use there too (source)
Electron also exposes the frame ID
Example
No response
Motivation
Impossible to uniquely identify frames right now
The text was updated successfully, but these errors were encountered: