/// <summary>
        /// Opens a Webdriver
        /// On Debug mode - will always open the browser on the local computer
        /// On Release mode - Check if the browser capability json is available and contains the
        /// browserType defined in that file, else will fall back to the local browser
        /// </summary>
        /// <param name="browserType"></param>
        public static IWebDriver InitializeDriver(string browserType)
        {
            var openLocalBrowser = Utility.Runtime.IsInDebugMode; //variable to determine local browser
            BrowserCapabilitiesModal browserCapability = null;
            IWebDriver driver = null;

            if (!openLocalBrowser && BrowserCapabilityHelper.CurrentBrowserCapabilities.Any())
            {
                browserCapability = BrowserCapabilityHelper.CurrentBrowserCapabilities.FirstOrDefault(c => c.CapabilityName.EqualsIgnoreCase(browserType));
                if (browserCapability != null)
                {
                    openLocalBrowser = false;
                }
            }

            if (openLocalBrowser)
            {
                driver = BrowserHelper.GetChromeBrowser();
                driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(EnvData["PageLoadTimeoutInSeconds"].ToInteger());
            }
            else
            {
                if (browserCapability != null)
                {
                    var buildNumber     = Environment.GetEnvironmentVariable("TRAVIS_BUILD_NUMBER") ?? string.Empty;
                    var travisJobNumber = Environment.GetEnvironmentVariable("TRAVIS_JOB_NUMBER") ?? string.Empty;
                    var sauceUsername   = Environment.GetEnvironmentVariable("SAUCE_USERNAME") ?? EnvData["SauceLabsUsername"];
                    var sauceAccessKey  = Environment.GetEnvironmentVariable("SAUCE_ACCESS_KEY") ?? EnvData["SauceLabsAccessKey"];

                    Console.WriteLine($"Travis CI build number: {buildNumber}");
                    Console.WriteLine($"Travis CI job number: {travisJobNumber}");
                    Console.WriteLine($"Travis CI username (sauce): {sauceUsername}");

                    var remoteDriverModel = new RemoteDriverAccessModel
                    {
                        RemoteHubUrl            = EnvData["SauceLabsRemoteHubUrl"],
                        CommandTimeoutInSeconds = EnvData["PageLoadTimeoutInSeconds"].ToInteger(),
                        Capabilities            = new Dictionary <string, string>
                        {
                            { "build", buildNumber },
                            { "tunnel-identifier", travisJobNumber },
                            { "username", sauceUsername },
                            { "accessKey", sauceAccessKey },
                            { "name", TestContext.CurrentContext.Test.Name }
                        }
                    };
                    remoteDriverModel.Capabilities.AddOrUpdate(browserCapability.ToCustomDictionary());
                    driver = BrowserHelper.GetRemoteDriver(remoteDriverModel);
                }
                else
                {
                    Assert.IsTrue(false, "The browser initialization failed as was not to determine which browser to open");
                }
            }
            if (SessionDrivers.ContainsKey(TestContext.CurrentContext.Test.Name))
            {
                driver?.CloseDriver();
                SessionDrivers.ContainsKey(TestContext.CurrentContext.Test.Name)
                .Should().BeFalse($"Driver already initiated for test: [{TestContext.CurrentContext.Test.Name}] with session id [{(driver as RemoteWebDriver).SessionId.ToString()}]");
            }
            else
            {
                SessionDrivers.TryAdd(TestContext.CurrentContext.Test.Name, driver);
            }
            return(driver);
        }