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
Support Electron and other content embedders #4283
Comments
Option 2 seems to be good-enough for me to address the e2e tests of electron apps. |
Do we have a list of all the protocol methods that are embedder-implemented which puppeteer uses? |
@JoelEinbinder it's more or less everything that's implemented in Most notable are browser contexts and ‘browser.close’. |
@aslushnikov: As option 2 might be the target, where will we find a test suite to base are own integration with this version ? |
@allavoie not sure I follow. Can you please elaborate what test suite would you need? |
@aslushnikov: I am referring to the tests you mentioned in your initial comment:
|
For some added context / confirmation here the methods that embedders would need to implement are just these ones in Electron currently only implements a handful of these https://github.com/electron/electron/blob/master/atom/browser/ui/devtools_manager_delegate.h#L25-L34 Implementing all of them would be a decent chunk of work and probably a maintenance burden especially when not many folks on Electron are heavily invested in puppeteer or implementing the missing bits of this protocol. If it's just If someone can point me at a conclusive list of APIs that Electron needs to implement for puppeteer to work I'm happy to look into it. |
any updates or workaround? downgrading to |
This combination seems to work: Refer to: https://github.com/peterdanis/electron-puppeteer-demo, I had to do a small change to make it work, but the idea is there. I was able to generate a png screenshot based on this repo. |
@MarshallOfSound I'm happy to help here!
For a reasonable testing story, I think it's actually just a single method that is missing:
With this, it should be possible to use most of Puppeteer API's to test Electron apps. I think this will satisfy the majority of the usecases today. |
@aslushnikov, @MarshallOfSound , also ready to help, if possible. |
Hi, I hope I have a relevant problem. The problem is that we can't respond to intercepted requests correctly using puppeteer in electron. I have a code snippet await chartPage.setRequestInterception(true);
await chartPage.on('request', (req) => {
if (req.url().includes('TracsProxy')) {
console.log(req);
req.respond({
status: 200,
contentType: 'application/json',
body: JSON.stringify(tracsProxyMock),
});
} else {
req.continue();
}
}); I'm using puppeteer-core: 2.1.1 |
What's a "content embedder"?
Chromium codebase is organized into layers:
//blink
- HTML rendering engine//content
- an API for browser implementers (think of it as a library that you'd use if you were to write your own browser). Things like process model are handled here; uses//blink
.//chrome
- Chromium implementation (uses//content
).Content-embedders are all the products that are based on
//content
layer. Chromium, Chrome Headless, ChromeCast are all different//content
embedders.Electron is a
//content
embedder as well.DevTools Protocol and content embedders
Majority of DevTools API is implemented in
//blink
and//content
. However, certain methods are supposed to be implemented by embedders. DevTools team makes sure all the methods needed for Puppeteer operation are supported by both Chromium and Headless.Electron is, however, missing out.
What exactly goes wrong?
contexts with the
Target.getBrowserContexts()
protocol method.Target.getBrowserContexts()
is supposed to be implemented by content embedders.What can be done?
Option 1: Defer to Embedders.
Ideally,
//content
-embedders implement all necessary DevTools protocol methods on their end. This way they'll guarantee 100% compatibility with Puppeteer API. This, however, is a major undertaking for embedders; not sure if there's any interest in this.Option 2: support clicking/typing/evaluation
Alternatively, we can aim for a "good-enough" compatibility with
//content
embedders. For example, we can make sure that things like clicking, navigation, typing and evaluation work fine with electron app (and add these electron tests to our CI). These should be enough to drive many default testing and automation scenarios.🚀 Vote!
Target.getBrowserContexts()
method. Plz cross-post the link here.The text was updated successfully, but these errors were encountered: