Example #1
0
 /// <inheritdoc/>
 public Task <IBrowserContext> NewContextAsync(BrowserContextOptions options)
 {
     options ??= new BrowserContextOptions();
     return(NewContextAsync(
                options.AcceptDownloads,
                options.IgnoreHTTPSErrors,
                options.BypassCSP,
                options.Viewport,
                screenSize: null,
                options.UserAgent,
                options.DeviceScaleFactor,
                options.IsMobile,
                options.HasTouch,
                options.JavaScriptEnabled,
                options.TimezoneId,
                options.Geolocation,
                options.Locale,
                options.Permissions,
                options.ExtraHTTPHeaders,
                options.Offline,
                options.HttpCredentials,
                options.ColorScheme,
                recordHarPath: null,
                recordHarOmitContent: null,
                recordVideoDir: null,
                recordVideoSize: null,
                options.Proxy,
                options.StorageState,
                options.StorageStatePath));
 }
        private BrowserContextOptions CopyFrom(BrowserContextOptions options)
        {
            options.UserAgent         = UserAgent;
            options.Viewport          = Viewport;
            options.HasTouch          = HasTouch;
            options.IsMobile          = IsMobile;
            options.DeviceScaleFactor = DeviceScaleFactor;

            return(options);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BrowserContextOptions"/> class.
 /// </summary>
 /// <param name="options">Device used to hydrate initial values.</param>
 public BrowserContextOptions(BrowserContextOptions options) => options?.CopyFrom(this);