Exemplo n.º 1
0
        /// <inheritdoc/>
        public async Task <IBrowserContext> NewContextAsync(BrowserContextOptions options)
        {
            var context = (await Channel.NewContextAsync(options ?? new BrowserContextOptions()).ConfigureAwait(false)).Object;

            context.Options = options;
            BrowserContextsList.Add(context);
            return(context);
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public async Task <IBrowserContext> NewContextAsync(BrowserContextOptions options = null)
        {
            var context = (await _channel.NewContextAsync(options).ConfigureAwait(false)).Object;

            BrowserContextsList.Add(context);
            context.Browser = this;
            return(context);
        }
Exemplo n.º 3
0
 internal void HydrateBrowserContextOptions(BrowserContextOptions options)
 {
     options.UserAgent         = UserAgent;
     options.Viewport          = Viewport;
     options.HasTouch          = HasTouch;
     options.IsMobile          = IsMobile;
     options.DeviceScaleFactor = DeviceScaleFactor;
 }
Exemplo n.º 4
0
        /// <inheritdoc/>
        public async Task <IPage> NewPageAsync(BrowserContextOptions options)
        {
            var context = await NewContextAsync(options).ConfigureAwait(false) as BrowserContext;

            var page = await context.NewPageAsync().ConfigureAwait(false) as Page;

            page.OwnedContext = context;
            context.OwnerPage = page;
            return(page);
        }
 internal ChromiumBrowserContext(
     ChromiumSession client,
     ChromiumBrowser chromiumBrowser,
     string contextId,
     BrowserContextOptions options)
 {
     _client    = client;
     Browser    = chromiumBrowser;
     _contextId = contextId;
     Options    = options;
 }
Exemplo n.º 6
0
        internal BrowserContext(IBrowserContextDelegate browserContextDelegate, BrowserContextOptions options = null)
        {
            _delegate = browserContextDelegate;
            _delegate.BrowserContext = this;
            Options = options?.Clone() ?? new BrowserContextOptions();

            Options.Viewport ??= new Viewport
            {
                Width  = 800,
                Height = 600,
            };
        }
 /// <summary>
 /// Adds all the values set int <paramref name="right"/> into <paramref name="left"/>.
 /// </summary>
 /// <param name="left"><see cref="LaunchPersistentOptions"/> to hidratate.</param>
 /// <param name="right"><see cref="BrowserContextOptions"/> to get the values from.</param>
 /// <returns><paramref name="left"/> with the values of <paramref name="right"/>.</returns>
 public static LaunchPersistentOptions Add(LaunchPersistentOptions left, BrowserContextOptions right) => left + right;
Exemplo n.º 8
0
 public async Task <IBrowserContext> NewContextAsync(BrowserContextOptions options = null)
 => (await _channel.NewContextAsync(options).ConfigureAwait(false)).Object;