/// <inheritdoc cref="IBrowserType.GetDefaultArgs(BrowserArgOptions)"/> public override string[] GetDefaultArgs(BrowserArgOptions options = null) { bool devtools = options?.Devtools ?? false; bool headless = options?.Headless ?? !devtools; string userDataDir = options?.UserDataDir; string[] args = options?.Args ?? Array.Empty <string>(); if (devtools) { throw new PlaywrightSharpException("Option \"devtools\" is not supported by Firefox"); } var firefoxArguments = new List <string>(DefaultArgs); if (userDataDir != null) { firefoxArguments.Add("-profile"); firefoxArguments.Add(userDataDir); } if (headless) { firefoxArguments.Add("-headless"); } else { firefoxArguments.Add("-wait-for-browser"); } firefoxArguments.AddRange(args); if (firefoxArguments.TrueForAll(arg => arg.StartsWith("-"))) { firefoxArguments.Add("about:blank"); } return(firefoxArguments.ToArray()); }
/// <inheritdoc cref="IBrowserType"/> public override string[] GetDefaultArgs(BrowserArgOptions options = null) { bool devtools = options?.Devtools ?? false; bool headless = options?.Headless ?? !devtools; string userDataDir = options?.UserDataDir; string[] args = options?.Args ?? Array.Empty <string>(); var chromeArguments = new List <string>(DefaultArgs); if (userDataDir != null) { chromeArguments.Add($"{UserDataDirArgument}={options.UserDataDir.Quote()}"); } if (devtools) { chromeArguments.Add("--auto-open-devtools-for-tabs"); } if (headless) { chromeArguments.AddRange(new[] { "--headless", "--hide-scrollbars", "--mute-audio", }); } if (args.All(arg => arg.StartsWith("-", StringComparison.Ordinal))) { chromeArguments.Add("about:blank"); } chromeArguments.AddRange(args); return(chromeArguments.ToArray()); }
/// <inheritdoc cref="IBrowserType.GetDefaultArgs(BrowserArgOptions)"/> public override string[] GetDefaultArgs(BrowserArgOptions options = null) { throw new NotImplementedException(); }