Closed gfaessler closed 3 years ago
Hi, I'm waiting for your reproducible case
Hello, following code triggers the issue.
If I remove the using statement on page or run each request on 1 thread one by one it works. Following code works using only Puppeteersharp or previous Pupeteersharp-Extra version. It looks like that on last version and in a multi-threaded environment some references remain on page object and it triggers an error when page object is disposed.
public static async Task Main(string[] args)
{
int parallelismDegree = 20;
List<string> sources = new List<string>();
for (int i = 0; i < 200; i++)
{
sources.Add("https://www.refugederborence.ch/?=" + i.ToString() );
}
// Initialization plugin builder
var extra = new PuppeteerExtra();
// Use stealth plugin
extra.Use(new StealthPlugin());
// Launch the puppeteer browser with plugins
var version = new BrowserFetcher().DownloadAsync().Result;
// Launch the puppeteer browser with plugins
using (var browser = await extra.LaunchAsync(new LaunchOptions { Headless = true, ExecutablePath = version.ExecutablePath, IgnoreHTTPSErrors=true }))
{
int sourceIndex = 0;
while (sourceIndex < sources.Count)
{
Console.WriteLine(string.Format("Running {0} tasks from startIndex : {1}", parallelismDegree, sourceIndex));
var tasks = sources.Skip(sourceIndex).Take(parallelismDegree).Select(async source =>
{
// Create a new page
using (var page = await browser.NewPageAsync())
{
await page.GoToAsync(source);
Console.WriteLine(string.Format("Running task : {0}", source));
}
});
await Task.WhenAll(tasks);
sourceIndex += parallelismDegree;
}
}
Console.WriteLine("Press a key to continue");
Console.ReadLine();
}
Good day! Is there any solution of it? Because, I also cannot start more then one browser instance at the same time, due this problem. Same error.
Hi, sorry to keep you waiting, I will fix it in a few days
Should be fixed by #26. Please update your NuGet package version to 1.3.1
I updated to latest version and with this version I regularly get following error :