Ejemplo n.º 1
0
        private void CheckPluginRequirements(BrowserStartContext context)
        {
            foreach (var puppeteerExtraPlugin in _plugins)
            {
                if (puppeteerExtraPlugin.Requirements is null)
                {
                    continue;
                }
                foreach (var requirement in puppeteerExtraPlugin.Requirements)
                {
                    switch (context.StartType)
                    {
                    case StartType.Launch when requirement == PluginRequirements.HeadFul && context.IsHeadless:
                        throw new NotSupportedException($"Plugin - {puppeteerExtraPlugin.GetName()} is not supported in headless mode");

                    case StartType.Connect when requirement == PluginRequirements.Launch:
                        throw new NotSupportedException($"Plugin - {puppeteerExtraPlugin.GetName()} doesn't support connect");
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private async Task OnStart(BrowserStartContext context, Browser browser)
 {
     OrderPlugins();
     CheckPluginRequirements(context);
     await Register(browser);
 }