/// <summary>
        ///     Makes a screenshot of the browser and performs additional actions if decorators are used.
        ///     <para></para>
        ///     For simple screenshot use strategy: new ScreenshotMaker()
        ///     <para></para>
        ///     More info can be founded at github page: https://github.com/Noksa/WebDriver.Screenshots.Extensions
        /// </summary>
        /// <param name="driver"></param>
        /// <param name="strategy"></param>
        /// <returns></returns>
        public static byte[] TakeScreenshot(this IWebDriver driver, IScreenshotStrategy strategy)
        {
            if (driver == null)
            {
                throw new ArgumentNullException(nameof(driver), @"Driver is null, can't take screenshot.");
            }
            if (strategy == null)
            {
                throw new ArgumentNullException(nameof(strategy), @"Strategy is null, can't take screenshot.");
            }
            driver.CheckIeDriver();
            driver.CheckJQueryOnPage();
            ScreenshotMaker.ScreenshotMaker screenshotMaker = null;
            switch (strategy)
            {
            case ScreenshotMaker.ScreenshotMaker sm:
                screenshotMaker = sm;
                break;

            case BaseScreenshotDecorator baseDecorator:
                screenshotMaker = GetScrenshotMakerStrategy(baseDecorator);
                break;
            }

            var magickImage = strategy.MakeScreenshot(driver);

            screenshotMaker?.RestoreAll();
            return(magickImage.ToByteArray());
        }
        /// <summary>
        ///     Makes a screenshot of the browser and performs additional actions if decorators are used.
        ///     <para></para>
        ///     For simple screenshot use strategy: new ScreenshotMaker()
        ///     <para></para>
        ///     More info can be founded at github page: https://github.com/Noksa/WebDriver.Screenshots.Extensions
        /// </summary>
        /// <param name="driver"></param>
        /// <param name="strategy"></param>
        /// <returns></returns>
        public static byte[] TakeScreenshot(this IWebDriver driver, IScreenshotStrategy strategy)
        {
            driver.CheckIeDriver();
            driver.CheckJQueryOnPage();
            ScreenshotMaker.ScreenshotMaker screenshotMaker = null;
            switch (strategy)
            {
            case ScreenshotMaker.ScreenshotMaker sm:
                screenshotMaker = sm;
                break;

            case BaseScreenshotDecorator baseDecorator:
                screenshotMaker = GetScrenshotMakerStrategy(baseDecorator);
                break;
            }

            var magickImage = strategy.MakeScreenshot(driver);

            screenshotMaker?.RestoreAll();
            return(magickImage.ToByteArray());
        }