处理页面会导致警告。这是一个问题吗?
Disposing a Page causes a warning. Is this an issue?
我有以下代码创建,然后通过 PuppeteerSharp 关闭 Chrome 页面:
var options = new LaunchOptions() {Headless = true, Args = new[] { "--disable-web-security" }};
Browser browser = await Puppeteer.LaunchAsync(options, factory);
Page page = await browser.NewPageAsync();
await page.CloseAsync();
page.Dispose();
最后一条语句 (page.Dispose) 导致写出以下警告:
PuppeteerSharp.Page:Warning: Protocol error: Connection closed. Most likely the page has been closed.
我有以下问题:
- 这是个问题吗?我可以忽略这个警告吗?
- 关闭页面后是否需要
.Dispose
?
如果调用 CloseAsync
,则无需调用 Dispose。 Dispose 只是一劳永逸地调用 CloseAsync。 See.
我有以下代码创建,然后通过 PuppeteerSharp 关闭 Chrome 页面:
var options = new LaunchOptions() {Headless = true, Args = new[] { "--disable-web-security" }};
Browser browser = await Puppeteer.LaunchAsync(options, factory);
Page page = await browser.NewPageAsync();
await page.CloseAsync();
page.Dispose();
最后一条语句 (page.Dispose) 导致写出以下警告:
PuppeteerSharp.Page:Warning: Protocol error: Connection closed. Most likely the page has been closed.
我有以下问题:
- 这是个问题吗?我可以忽略这个警告吗?
- 关闭页面后是否需要
.Dispose
?
如果调用 CloseAsync
,则无需调用 Dispose。 Dispose 只是一劳永逸地调用 CloseAsync。 See.