public static async Task <Page> CreateAsync(Session client, Target target, bool ignoreHTTPSErrors, bool appMode, TaskQueue screenshotTaskQueue) { await client.SendAsync("Page.enable", null); dynamic result = await client.SendAsync("Page.getFrameTree"); var page = new Page(client, target, new FrameTree(result.frameTree), ignoreHTTPSErrors, screenshotTaskQueue); await Task.WhenAll( client.SendAsync("Page.setLifecycleEventsEnabled", new Dictionary <string, object> { { "enabled", true } }), client.SendAsync("Network.enable", null), client.SendAsync("Runtime.enable", null), client.SendAsync("Security.enable", null), client.SendAsync("Performance.enable", null) ); if (ignoreHTTPSErrors) { await client.SendAsync("Security.setOverrideCertificateErrors", new Dictionary <string, object> { { "override", true } }); } // Initialize default page size. if (!appMode) { await page.SetViewport(new ViewPortOptions { Width = 800, Height = 600 }); } return(page); }