Esempio n. 1
0
        public async Task <IBrowser> LaunchAsync(BrowserTypeLaunchOptions options = default)
        {
            options ??= new BrowserTypeLaunchOptions();
            Browser browser = (await _channel.LaunchAsync(
                                   headless: options.Headless,
                                   channel: options.Channel,
                                   executablePath: options.ExecutablePath,
                                   passedArguments: options.Args,
                                   proxy: options.Proxy,
                                   downloadsPath: options.DownloadsPath,
                                   tracesDir: options.TracesDir,
                                   chromiumSandbox: options.ChromiumSandbox,
                                   firefoxUserPrefs: options.FirefoxUserPrefs,
                                   handleSIGINT: options.HandleSIGINT,
                                   handleSIGTERM: options.HandleSIGTERM,
                                   handleSIGHUP: options.HandleSIGHUP,
                                   timeout: options.Timeout,
                                   env: options.Env,
                                   devtools: options.Devtools,
                                   slowMo: options.SlowMo,
                                   ignoreDefaultArgs: options.IgnoreDefaultArgs,
                                   ignoreAllDefaultArgs: options.IgnoreAllDefaultArgs).ConfigureAwait(false)).Object;

            browser.LocalUtils = Playwright.Utils;
            return(browser);
        }
        /// <inheritdoc />
        public async Task <IBrowser> LaunchAsync(LaunchOptions options = null)
        {
            if (!string.IsNullOrEmpty(options?.UserDataDir))
            {
                throw new ArgumentException("UserDataDir option is not supported in LaunchAsync. Use LaunchPersistentContextAsync instead");
            }

            return((await _channel.LaunchAsync(options ?? new LaunchOptions()).ConfigureAwait(false)).Object);
        }
Esempio n. 3
0
 /// <inheritdoc/>
 public async Task <IBrowser> LaunchAsync(
     bool?headless             = default,
     BrowserChannel channel    = default,
     string executablePath     = default,
     IEnumerable <string> args = default,
     Proxy proxy          = default,
     string downloadsPath = default,
     bool?chromiumSandbox = default,
     IEnumerable <KeyValuePair <string, object> > firefoxUserPrefs = 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,
     IEnumerable <string> ignoreDefaultArgs = default,
     bool?ignoreAllDefaultArgs = default)
 => (await _channel.LaunchAsync(
         headless,
         channel,
         executablePath,
         args,
         proxy,
         downloadsPath,
         chromiumSandbox,
         firefoxUserPrefs,
         handleSIGINT,
         handleSIGTERM,
         handleSIGHUP,
         timeout,
         env,
         devtools,
         slowMo,
         ignoreDefaultArgs,
         ignoreAllDefaultArgs).ConfigureAwait(false)).Object;
Esempio n. 4
0
 /// <inheritdoc />
 public async Task <IBrowser> LaunchAsync(LaunchOptions options = null)
 => (await _channel.LaunchAsync(options).ConfigureAwait(false)).Object;