/// <inheritdoc/> public Task <IPage> NewPageAsync( ViewportSize viewport, string userAgent = null, bool?bypassCSP = null, bool?javaScriptEnabled = null, string timezoneId = null, Geolocation geolocation = null, ContextPermission[] permissions = null, bool?isMobile = null, bool?offline = null, decimal?deviceScaleFactor = null, Credentials httpCredentials = null, bool?hasTouch = null, bool?acceptDownloads = null, bool?ignoreHTTPSErrors = null, ColorScheme?colorScheme = null, string locale = null, Dictionary <string, string> extraHTTPHeaders = null, RecordHarOptions recordHar = null, RecordVideoOptions recordVideo = null, ProxySettings proxy = null, string storageStatePath = null, StorageState storageState = null) => NewPageAsync(new BrowserContextOptions { Viewport = viewport, UserAgent = userAgent, BypassCSP = bypassCSP, JavaScriptEnabled = javaScriptEnabled, TimezoneId = timezoneId, Geolocation = geolocation, Permissions = permissions, IsMobile = isMobile, Offline = offline, DeviceScaleFactor = deviceScaleFactor, HttpCredentials = httpCredentials, HasTouch = hasTouch, AcceptDownloads = acceptDownloads, IgnoreHTTPSErrors = ignoreHTTPSErrors, ColorScheme = colorScheme, Locale = locale, ExtraHTTPHeaders = extraHTTPHeaders, RecordHar = recordHar, RecordVideo = recordVideo, Proxy = proxy, StorageStatePath = storageStatePath, StorageState = storageState, });
internal Dictionary <string, object> ToChannelDictionary() { var args = new Dictionary <string, object>(); if (Viewport == null) { args["noDefaultViewport"] = true; } else if (!Viewport.Equals(ViewportSize.None)) { args["viewport"] = Viewport; } if (!string.IsNullOrEmpty(UserAgent)) { args["userAgent"] = UserAgent; } if (BypassCSP != null) { args["bypassCSP"] = BypassCSP; } if (JavaScriptEnabled != null) { args["javaScriptEnabled"] = JavaScriptEnabled; } if (IgnoreHTTPSErrors != null) { args["ignoreHTTPSErrors"] = IgnoreHTTPSErrors; } if (!string.IsNullOrEmpty(TimezoneId)) { args["timezoneId"] = TimezoneId; } if (Geolocation != null) { args["geolocation"] = Geolocation; } if (Permissions != null) { args["permissions"] = Permissions; } if (IsMobile != null) { args["isMobile"] = IsMobile; } if (Offline != null) { args["offline"] = Offline; } if (DeviceScaleFactor != null) { args["deviceScaleFactor"] = DeviceScaleFactor; } if (HttpCredentials != null) { args["httpCredentials"] = HttpCredentials; } if (HasTouch != null) { args["hasTouch"] = HasTouch; } if (AcceptDownloads != null) { args["acceptDownloads"] = AcceptDownloads; } if (ColorScheme != null) { args["colorScheme"] = ColorScheme; } if (Locale != null) { args["locale"] = Locale; } if (ExtraHTTPHeaders != null) { args["extraHTTPHeaders"] = ExtraHTTPHeaders.Select(kv => new HeaderEntry { Name = kv.Key, Value = kv.Value }).ToArray(); } if (RecordHar != null) { args["recordHar"] = RecordHar; } if (RecordVideo != null) { args["recordVideo"] = RecordVideo; } if (Proxy != null) { args["proxy"] = Proxy; } if (!string.IsNullOrEmpty(StorageStatePath)) { StorageState = JsonSerializer.Deserialize <StorageState>(File.ReadAllText(StorageStatePath), JsonExtensions.DefaultJsonSerializerOptions); } if (StorageState != null) { args["storageState"] = StorageState; } return(args); }