As you may have heard, Microsoft made available to the public its Chromium-powered Edge browser. Maybe this question won't qualify as technical interview question but:
If Puppeteer-Sharp automates Chromium, and Microsoft Edge (insider) is powered by chromium, that would mean that...
When you call Puppeteer.LaunchAsync
, one of the values you can set in the LaunchOptions
is the ExecutablePath.
So, what would happen if we launch Puppeteer passing our Microsoft Edge browser path?
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true,
ExecutablePath = "C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe"
});
Let's write a super simple example:
var browserOptions = new LaunchOptions
{
Headless = false,
ExecutablePath = "C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe"
};
var browser = await Puppeteer.LaunchAsync(browserOptions);
var page = await browser.NewPageAsync();
await page.SetContentAsync("<div>Testing</div>");
Voilà!
And after a few tweaks in puppeteer-sharp, and one similar change in puppeteer, we managed to get all tests running using Microsoft Edge!
So we can say that Puppeteer-Sharp v1.14 is fully compatible with Microsoft Edge Insider version 75.0.131.0.
Don't stop coding!
Originally posted on harkoded.com