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
[API request] Expose the Chrome DevTools target as a page
#9371
Comments
It should be possible to re-define what Puppeteer considers to be a page via the isPageCallback: https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/services/puppeteer/PuppeteerConnection.ts;l=90;drc=a30fb93648955c875c7fac7d30eee58d2dd80819 Although accessing the callback requires using some internal APIs, would it work for your use case in general? |
This would potentially work. However, unless I'm misunderstanding, it seems like the client would then have determine whether any target is a page or not, not just the Chrome DevTools target? Ideally it would be nice to have a way to defer back to Puppeteer if we are uninterested in specifying whether the target is a page. Eg:
|
@elliette that's why it's not a public API yet |
Adding @xvrh who owns https://github.com/xvrh/puppeteer-dart - thoughts on |
@elliette if I recall correctly, DevTools in undocked mode is reported as a page. Perhaps that would be helpful but I am not sure if you can start it undocked. |
Related #9262 |
In experimenting with this, I was able to simulate undocking DevTools by getting its URL and then opening a new page with that URL. However, this new DevTools in a page does not have the panels added by my Chrome Extension. |
Any updates on this? The workaround mentioned in the OP is no longer possible for JavaScript either. I do see there is an "internal"
|
@thuey no updates |
While DevTools won't show up in the `Browser.pages()` it would be available via its target. Closes #9371
While DevTools won't show up in the `Browser.pages()` it would be available via its target. Closes #9371
While DevTools won't show up in the `Browser.pages()` it would be available via its target. Closes #9371
While DevTools won't show up in the `Browser.pages()` it would be available via its target. Closes #9371
While DevTools won't show up in the `Browser.pages()` it would be available via its target. Closes #9371
Bug description
Filing a new issue instead of reopening #4247 where this was first proposed (it was closed in 2019 because it was believed the reporter was the only client trying to use Puppeteer to test a panel added to Chrome DevTools by their Chrome extension, from the comments / recently opened issues it seems that is no longer the case).
As described in #4247 (comment), currently the only way to interact with a panel added to Chrome DevTools by a Chrome extension is to use a hack to set the target type to
page
:This hack is used by the
puppeteer-devtools
library (code pointer) which was recently cited in #9327 as a way to test a Chrome Extension devtools panel.Why this doesn't work for my use case:
I'm using the Dart language wrapper of Puppeteer to test my Chrome extension (which is also written in Dart). Because Dart is a strongly-typed language that prevents access to
private
members (such as_targetInfo
), this hack is not possible. I could ask the owner of the Dart Puppeteer implementation to expose this hack in their API, but it seems like a better solution for Puppeteer itself to support this as a real use case and not as a hack.From #4247 (comment), it sounds like supporting this as an actual use case would be possible.
Thank you!
Puppeteer version
N/A
Node.js version
N/A
npm version
N/A
What operating system are you seeing the problem on?
macOS
Configuration file
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: