public static async Task Cleanup() { if (BrowserBase == null) { return; } await BrowserBase.CloseAsync(); }
public static async Task Initialize() { if (BrowserBase != null) { await BrowserBase.CloseAsync(); } await DownloadBrowser(); BrowserBase = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = false, Args = new[] { "--start-maximized" }, DefaultViewport = null, Timeout = 10000 }); PageBase = await BrowserBase.NewPageAsync(); PageBase.DefaultNavigationTimeout = (int)TimeSpan.FromSeconds(15).TotalMilliseconds; }