Esempio n. 1
0
        /// <inheritdoc/>
        public async Task <IPage> NewPageAsync(
            bool?acceptDownloads,
            bool?ignoreHTTPSErrors,
            bool?bypassCSP,
            ViewportSize viewportSize,
            ScreenSize screenSize,
            string userAgent,
            float?deviceScaleFactor,
            bool?isMobile,
            bool?hasTouch,
            bool?javaScriptEnabled,
            string timezoneId,
            Geolocation geolocation,
            string locale,
            IEnumerable <string> permissions,
            IEnumerable <KeyValuePair <string, string> > extraHTTPHeaders,
            bool?offline,
            HttpCredentials httpCredentials,
            ColorScheme colorScheme,
            string recordHarPath,
            bool?recordHarOmitContent,
            string recordVideoDir,
            RecordVideoSize recordVideoSize,
            Proxy proxy,
            string storageState,
            string storageStatePath)
        {
            var context = (BrowserContext) await NewContextAsync(
                acceptDownloads,
                ignoreHTTPSErrors,
                bypassCSP,
                viewportSize,
                screenSize,
                userAgent,
                deviceScaleFactor,
                isMobile,
                hasTouch,
                javaScriptEnabled,
                timezoneId,
                geolocation,
                locale,
                permissions,
                extraHTTPHeaders,
                offline,
                httpCredentials,
                colorScheme,
                recordHarPath,
                recordHarOmitContent,
                recordVideoDir,
                recordVideoSize,
                proxy,
                storageState,
                storageStatePath).ConfigureAwait(false);

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

            page.OwnedContext = context;
            context.OwnerPage = page;
            return(page);
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public async Task <IBrowserContext> NewContextAsync(
            bool?acceptDownloads,
            bool?ignoreHTTPSErrors,
            bool?bypassCSP,
            ViewportSize viewportSize,
            ScreenSize screenSize,
            string userAgent,
            float?deviceScaleFactor,
            bool?isMobile,
            bool?hasTouch,
            bool?javaScriptEnabled,
            string timezoneId,
            Geolocation geolocation,
            string locale,
            IEnumerable <string> permissions,
            IEnumerable <KeyValuePair <string, string> > extraHTTPHeaders,
            bool?offline,
            HttpCredentials httpCredentials,
            ColorScheme colorScheme,
            string recordHarPath,
            bool?recordHarOmitContent,
            string recordVideoDir,
            RecordVideoSize recordVideoSize,
            Proxy proxy,
            string storageState,
            string storageStatePath)
        {
            var context = (await Channel.NewContextAsync(
                               acceptDownloads,
                               bypassCSP,
                               colorScheme,
                               deviceScaleFactor,
                               extraHTTPHeaders,
                               geolocation,
                               hasTouch,
                               httpCredentials,
                               ignoreHTTPSErrors,
                               isMobile,
                               javaScriptEnabled,
                               locale,
                               offline,
                               permissions,
                               proxy,
                               recordHarOmitContent,
                               recordHarPath,
                               recordVideoDir,
                               recordVideoSize,
                               storageState,
                               storageStatePath,
                               timezoneId,
                               userAgent,
                               viewportSize).ConfigureAwait(false)).Object;

            context.RecordVideo = !string.IsNullOrEmpty(recordVideoDir);

            BrowserContextsList.Add(context);
            return(context);
        }
Esempio n. 3
0
 /// <inheritdoc/>
 public async Task <IBrowserContext> LaunchPersistentContextAsync(
     string userDataDir,
     bool?headless             = default,
     BrowserChannel channel    = default,
     string executablePath     = default,
     IEnumerable <string> args = default,
     Proxy proxy          = default,
     string downloadsPath = default,
     bool?chromiumSandbox = default,
     bool?handleSIGINT    = default,
     bool?handleSIGTERM   = default,
     bool?handleSIGHUP    = default,
     float?timeout        = default,
     IEnumerable <KeyValuePair <string, string> > env = default,
     bool?devtools                    = default,
     float?slowMo                     = default,
     bool?acceptDownloads             = default,
     bool?ignoreHTTPSErrors           = default,
     bool?bypassCSP                   = default,
     ViewportSize viewportSize        = default,
     ScreenSize screenSize            = default,
     string userAgent                 = default,
     float?deviceScaleFactor          = default,
     bool?isMobile                    = default,
     bool?hasTouch                    = default,
     bool?javaScriptEnabled           = default,
     string timezoneId                = default,
     Geolocation geolocation          = default,
     string locale                    = default,
     IEnumerable <string> permissions = default,
     IEnumerable <KeyValuePair <string, string> > extraHTTPHeaders = default,
     bool?offline = default,
     HttpCredentials httpCredentials        = default,
     ColorScheme colorScheme                = default,
     string recordHarPath                   = default,
     bool?recordHarOmitContent              = default,
     string recordVideoDir                  = default,
     RecordVideoSize recordVideoSize        = default,
     IEnumerable <string> ignoreDefaultArgs = default,
     bool?ignoreAllDefaultArgs              = default) =>
 (await _channel.LaunchPersistentContextAsync(
      userDataDir,
      headless,
      channel,
      executablePath,
      args,
      proxy,
      downloadsPath,
      chromiumSandbox,
      handleSIGINT,
      handleSIGTERM,
      handleSIGHUP,
      timeout,
      env,
      devtools,
      slowMo,
      acceptDownloads,
      ignoreHTTPSErrors,
      bypassCSP,
      viewportSize,
      screenSize,
      userAgent,
      deviceScaleFactor,
      isMobile,
      hasTouch,
      javaScriptEnabled,
      timezoneId,
      geolocation,
      locale,
      permissions,
      extraHTTPHeaders,
      offline,
      httpCredentials,
      colorScheme,
      recordHarPath,
      recordHarOmitContent,
      recordVideoDir,
      recordVideoSize,
      ignoreDefaultArgs,
      ignoreAllDefaultArgs).ConfigureAwait(false)).Object;