/// <summary>
 /// Gets the web driver for standalone browsers.
 /// </summary>
 /// <param name="testSettings">The test settings.</param>
 /// <param name="browserVersion">The browser version.</param>
 /// <param name="testOutputHelper">The test output helper.</param>
 /// <returns></returns>
 public static ITestWebDriver InitializeStandaloneBrowserDriver(TestSettings testSettings, decimal browserVersion,
     ITestOutputHelper testOutputHelper)
 {
     ScreenShotCounter = 0;
     TestOutputHelper = testOutputHelper;
     testSettings = ValidateSavePaths(testSettings);
     switch (testSettings.DriverType)
     {
         case WebDriverType.ChromeDriver:
         {
             string driverLocation;
             switch (browserVersion.ToString(CultureInfo.InvariantCulture))
             {
                 case "48":
                 case "47":
                 case "46":
                 case "45":
                 case "44":
                 case "43":
                     driverLocation =
                         Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                         "\\MultiBrowser\\Drivers\\ChromeDrivers\\2.20\\chromedriver.exe";
                     break;
                 case "42":
                 case "41":
                 case "40":
                 case "39":
                     driverLocation =
                         Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                         "\\MultiBrowser\\Drivers\\ChromeDrivers\\2.14\\chromedriver.exe";
                     break;
                 case "38":
                 case "37":
                 case "36":
                     driverLocation =
                         Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                         "\\MultiBrowser\\Drivers\\ChromeDrivers\\2.11\\chromedriver.exe";
                     break;
                 case "35":
                 case "34":
                 case "33":
                     driverLocation =
                         Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                         "\\MultiBrowser\\Drivers\\ChromeDrivers\\2.10\\chromedriver.exe";
                     break;
                 case "32":
                 case "31":
                 case "30":
                     driverLocation =
                         Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                         "\\MultiBrowser\\Drivers\\ChromeDrivers\\2.8\\chromedriver.exe";
                     break;
                 default:
                     driverLocation = Path.Combine(AssemblyDirectory, "chromedriver.exe");
                     break;
             }
             ValidateDriverPresentOrUnblocked(WebDriverType.ChromeDriver, driverLocation);
             testSettings.BrowserName = "Chrome " + browserVersion;
             var multiBrowserExe =
                 Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                 "\\MultiBrowser\\MB_Chrome" + browserVersion + ".exe";
             var driverService = ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverLocation),
                 Path.GetFileName(driverLocation));
             var options = new ChromeOptions
             {
                 LeaveBrowserRunning = false,
                 BinaryLocation = multiBrowserExe
             };
             options.AddArgument("--no-default-browser-check");
             options.AddArgument("--test-type=browser");
             options.AddArgument("--start-maximized");
             options.AddArgument("--allow-no-sandbox-job");
             options.AddArgument("--disable-component-update");
             options.AddArgument("--auth-server-whitelist=" + testSettings.TestUri.Authority.Replace("www", "*"));
             var driver = new ChromeDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.FirefoxDriver:
         {
             testSettings.BrowserName = "Firefox " + browserVersion;
             var multiBrowserExe =
                 Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                 "\\MultiBrowser\\MB_Chrome" + browserVersion + ".exe";
             var driverService = FirefoxDriverService.CreateDefaultService();
             driverService.FirefoxBinaryPath = multiBrowserExe;
             var options = new FirefoxOptions();
             var driver = new FirefoxDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.InternetExplorerDriver:
         {
             testSettings.BrowserName = "IE " + browserVersion;
             string driverLocation;
             if (!Environment.Is64BitProcess)
             {
                 driverLocation = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                  "\\MultiBrowser\\Drivers\\IEDrivers\\x86\\IEDriverServer.exe";
             }
             else
             {
                 driverLocation = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                                  "\\MultiBrowser\\Drivers\\IEDrivers\\x64\\IEDriverServer64.exe";
             }
             var driverService =
                 InternetExplorerDriverService.CreateDefaultService(Path.GetDirectoryName(driverLocation),
                     Path.GetFileName(driverLocation));
             var options = new InternetExplorerOptions
             {
                 IgnoreZoomLevel = true,
                 IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                 BrowserAttachTimeout = testSettings.TimeoutTimeSpan,
                 RequireWindowFocus = true,
                 ElementScrollBehavior = InternetExplorerElementScrollBehavior.Bottom,
                 InitialBrowserUrl = testSettings.TestUri.AbsoluteUri,
                 EnsureCleanSession = true,
                 EnableNativeEvents = true
             };
             var driver = new InternetExplorerDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.EdgeDriver:
         {
             testSettings.BrowserName = "Edge " + browserVersion;
             var driverService = EdgeDriverService.CreateDefaultService(AssemblyDirectory,
                 "MicrosoftWebDriver.exe");
             var options = new EdgeOptions
             {
                 PageLoadStrategy = EdgePageLoadStrategy.Default
             };
             var driver = new EdgeDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.OperaDriver:
         {
             testSettings.BrowserName = "Opera " + browserVersion;
             var multiBrowserExe =
                 Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                 "\\MultiBrowser\\MB_Chrome" + browserVersion + ".exe";
             var driverService = OperaDriverService.CreateDefaultService();
             var options = new OperaOptions
             {
                 LeaveBrowserRunning = false,
                 BinaryLocation = multiBrowserExe
             };
             var driver = new OperaDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.SafariDriver:
         {
             testSettings.BrowserName = "Firefox " + browserVersion;
             var multiBrowserExe =
                 Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                 "\\MultiBrowser\\MB_Chrome" + browserVersion + ".exe";
             var options = new SafariOptions
             {
                 SafariLocation = multiBrowserExe
             };
             var driver = new SafariDriver(options);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
     }
     return null;
 }
Ejemplo n.º 2
0
 private static ICapabilities ConvertOptionsToCapabilities(OperaOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException("options", "options must not be null");
     }
     return(options.ToCapabilities());
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified path
 /// to the directory containing OperaDriver.exe and options.
 /// </summary>
 /// <param name="operaDriverDirectory">The full path to the directory containing OperaDriver.exe.</param>
 /// <param name="options">The <see cref="OperaOptions"/> to be used with the Opera driver.</param>
 public OperaDriver(string operaDriverDirectory, OperaOptions options)
     : this(operaDriverDirectory, options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified options.
 /// </summary>
 /// <param name="options">The <see cref="OperaOptions"/> to be used with the Opera driver.</param>
 public OperaDriver(OperaOptions options)
     : this(OperaDriverService.CreateDefaultService(), options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified <see cref="OperaDriverService"/>.
 /// </summary>
 /// <param name="service">The <see cref="OperaDriverService"/> to use.</param>
 /// <param name="options">The <see cref="OperaOptions"/> to be used with the Opera driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public OperaDriver(OperaDriverService service, OperaOptions options, TimeSpan commandTimeout)
     : base(new DriverServiceCommandExecutor(service, commandTimeout), ConvertOptionsToCapabilities(options))
 {
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified
 /// <see cref="OperaDriverService"/> and options.
 /// </summary>
 /// <param name="service">The <see cref="OperaDriverService"/> to use.</param>
 /// <param name="options">The <see cref="OperaOptions"/> used to initialize the driver.</param>
 public OperaDriver(OperaDriverService service, OperaOptions options)
     : this(service, options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified path
 /// to the directory containing OperaDriver.exe, options, and command timeout.
 /// </summary>
 /// <param name="operaDriverDirectory">The full path to the directory containing OperaDriver.exe.</param>
 /// <param name="options">The <see cref="OperaOptions"/> to be used with the Opera driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public OperaDriver(string operaDriverDirectory, OperaOptions options, TimeSpan commandTimeout)
     : this(OperaDriverService.CreateDefaultService(operaDriverDirectory), options, commandTimeout)
 {
 }
 /// <summary>
 /// Gets the web driver for locally installed browsers.
 /// </summary>
 /// <param name="testSettings">The test settings.</param>
 /// <param name="testOutputHelper">The test output helper.</param>
 /// <returns></returns>
 /// <exception cref="TestConfigurationException">The details you specified are invalid</exception>
 /// <exception cref="TestConfigurationException">The details you specified are invalid</exception>
 public static ITestWebDriver InitializeInstalledBrowserDriver(TestSettings testSettings,
     ITestOutputHelper testOutputHelper)
 {
     ScreenShotCounter = 0;
     TestOutputHelper = testOutputHelper;
     testSettings = ValidateSavePaths(testSettings);
     switch (testSettings.DriverType)
     {
         case WebDriverType.ChromeDriver:
         {
             string driverLocation = Path.Combine(AssemblyDirectory, "chromedriver.exe");
             driverLocation = ValidateDriverPresentOrUnblocked(WebDriverType.ChromeDriver, driverLocation);
             testSettings.BrowserName = "Chrome";
             var driverService = ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverLocation),
                 Path.GetFileName(driverLocation));
             var options = new ChromeOptions
             {
                 LeaveBrowserRunning = false
             };
             options.AddArgument("--no-default-browser-check");
             options.AddArgument("--test-type=browser");
             options.AddArgument("--start-maximized");
             options.AddArgument("--allow-no-sandbox-job");
             options.AddArgument("--disable-component-update");
             options.AddArgument("--auth-server-whitelist=" + testSettings.TestUri.Authority.Replace("www", "*"));
             var driver = new ChromeDriver(driverService, options, testSettings.TimeoutTimeSpan);
             var firingDriver = AttachDriverEvents(driver);
             if (testSettings.DeleteAllCookies)
             {
                 firingDriver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 firingDriver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(firingDriver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.FirefoxDriver:
         {
             testSettings.BrowserName = "Firefox";
             string winePath =
                 Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
                 "\\MultiBrowser\\Drivers\\FirefoxDrivers\\wires-0.6.2-win\\";
             var driverService = FirefoxDriverService.CreateDefaultService(winePath);
                 //var driverService = FirefoxDriverService.CreateDefaultService();
                 var options = new FirefoxOptions();
             options.IsMarionette = true;
             var driver = new FirefoxDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.InternetExplorerDriver:
         {
             testSettings.BrowserName = "IE";
             var driverName = "IEDriverServer.exe";
             if (Environment.Is64BitProcess)
             {
                 driverName = "IEDriverServer64.exe";
             }
             string driverLocation = Path.Combine(AssemblyDirectory, driverName);
             driverLocation = ValidateDriverPresentOrUnblocked(WebDriverType.InternetExplorerDriver,
                 driverLocation);
             var driverService =
                 InternetExplorerDriverService.CreateDefaultService(Path.GetDirectoryName(driverLocation),
                     Path.GetFileName(driverLocation));
             var options = new InternetExplorerOptions
             {
                 IgnoreZoomLevel = true,
                 IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                 BrowserAttachTimeout = testSettings.TimeoutTimeSpan,
                 RequireWindowFocus = true,
                 ElementScrollBehavior = InternetExplorerElementScrollBehavior.Bottom,
                 InitialBrowserUrl = testSettings.TestUri.AbsoluteUri,
                 EnsureCleanSession = true,
                 EnableNativeEvents = true
             };
             var driver = new InternetExplorerDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.EdgeDriver:
         {
             string driverLocation = Path.Combine(AssemblyDirectory, "MicrosoftWebDriver.exe");
             driverLocation = ValidateDriverPresentOrUnblocked(WebDriverType.EdgeDriver, driverLocation);
             testSettings.BrowserName = "Edge";
             var driverService = EdgeDriverService.CreateDefaultService(Path.GetDirectoryName(driverLocation),
                 Path.GetFileName(driverLocation));
             var options = new EdgeOptions
             {
                 PageLoadStrategy = EdgePageLoadStrategy.Default
             };
             var driver = new EdgeDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.OperaDriver:
         {
             testSettings.BrowserName = "Opera";
             var driverService = OperaDriverService.CreateDefaultService();
             var options = new OperaOptions
             {
                 LeaveBrowserRunning = false
             };
             var driver = new OperaDriver(driverService, options, testSettings.TimeoutTimeSpan);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
         case WebDriverType.SafariDriver:
         {
             testSettings.BrowserName = "Safari";
             var options = new SafariOptions();
             var driver = new SafariDriver(options);
             if (testSettings.DeleteAllCookies)
             {
                 driver.Manage().Cookies.DeleteAllCookies();
             }
             driver.Manage().Timeouts().ImplicitlyWait(testSettings.TimeoutTimeSpan);
             if (testSettings.MaximiseBrowser)
             {
                 driver.Manage().Window.Maximize();
             }
             var extendedWebDriver = new TestWebDriver(driver, testSettings, TestOutputHelper);
             TestWebDriver = extendedWebDriver;
             return extendedWebDriver;
         }
     }
     throw new TestConfigurationException("The details you specified are invalid");
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified path
 /// to the directory containing OperaDriver.exe and options.
 /// </summary>
 /// <param name="operaDriverDirectory">The full path to the directory containing OperaDriver.exe.</param>
 /// <param name="options">The <see cref="OperaOptions"/> to be used with the Opera driver.</param>
 public OperaDriver(string operaDriverDirectory, OperaOptions options)
     : this(operaDriverDirectory, options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified options.
 /// </summary>
 /// <param name="options">The <see cref="OperaOptions"/> to be used with the Opera driver.</param>
 public OperaDriver(OperaOptions options)
     : this(OperaDriverService.CreateDefaultService(), options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Ejemplo n.º 11
0
        private static ICapabilities ConvertOptionsToCapabilities(OperaOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options", "options must not be null");
            }

            return options.ToCapabilities();
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified <see cref="OperaDriverService"/>.
 /// </summary>
 /// <param name="service">The <see cref="OperaDriverService"/> to use.</param>
 /// <param name="options">The <see cref="OperaOptions"/> to be used with the Opera driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public OperaDriver(OperaDriverService service, OperaOptions options, TimeSpan commandTimeout)
     : base(new DriverServiceCommandExecutor(service, commandTimeout), ConvertOptionsToCapabilities(options))
 {
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified
 /// <see cref="OperaDriverService"/> and options.
 /// </summary>
 /// <param name="service">The <see cref="OperaDriverService"/> to use.</param>
 /// <param name="options">The <see cref="OperaOptions"/> used to initialize the driver.</param>
 public OperaDriver(OperaDriverService service, OperaOptions options)
     : this(service, options, RemoteWebDriver.DefaultCommandTimeout)
 {
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OperaDriver"/> class using the specified path
 /// to the directory containing OperaDriver.exe, options, and command timeout.
 /// </summary>
 /// <param name="operaDriverDirectory">The full path to the directory containing OperaDriver.exe.</param>
 /// <param name="options">The <see cref="OperaOptions"/> to be used with the Opera driver.</param>
 /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
 public OperaDriver(string operaDriverDirectory, OperaOptions options, TimeSpan commandTimeout)
     : this(OperaDriverService.CreateDefaultService(operaDriverDirectory), options, commandTimeout)
 {
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Возвращает драйвер браузера с настройками прокси на актуальный сервер
 /// </summary>
 /// <returns></returns>
 public IWebDriver GetDriver(bool useProxy)
 {
     IWebDriver driver = null;
     if (useProxy)
     {
         Random r = new Random(DateTime.Now.Millisecond);
         bool workedProxyIsFound = false;
         //выбираем случайный прокси из списка адресов в конфиге до тех пор, пока не найдем рабочий
         do
         {
             int proxyIndex = r.Next(document["settings"]["proxies"].ChildNodes.Count);
             string PROXY = document["settings"]["proxies"].ChildNodes[proxyIndex].Attributes[0].Value;
             Proxy proxy = new Proxy();
             proxy.HttpProxy = PROXY;
             proxy.FtpProxy = PROXY;
             proxy.SslProxy = PROXY;
             switch (document["settings"]["driver"].GetAttribute("name"))
             {
                 case "GoogleChrome":
                     ChromeOptions chromeOptions = new ChromeOptions();
                     chromeOptions.Proxy = proxy;
                     driver = new ChromeDriver(document["settings"]["driver"].GetAttribute("path"), chromeOptions, TimeSpan.FromSeconds(300));
                     break;
                 case "Firefox":
                     FirefoxProfile profile = new FirefoxProfile();
                     profile.SetProxyPreferences(proxy);
                     driver = new FirefoxDriver(new FirefoxBinary(), profile, TimeSpan.FromSeconds(300));
                     break;
                 case "Opera":
                     OperaOptions operaOptions = new OperaOptions();
                     operaOptions.Proxy = proxy;
                     driver = new OperaDriver(document["settings"]["driver"].GetAttribute("path"), operaOptions, TimeSpan.FromSeconds(300));
                     break;
                 case "IE":
                     InternetExplorerOptions IEOptions = new InternetExplorerOptions();
                     IEOptions.Proxy = proxy;
                     driver = new InternetExplorerDriver(document["settings"]["driver"].GetAttribute("path"), IEOptions, TimeSpan.FromSeconds(300));
                     break;
             }
             //Проверяем работу прокси обращаясь к гуглу
             driver.Navigate().GoToUrl("http://www.google.ru/");
             Thread.Sleep(10000);
             workedProxyIsFound = driver.Title == "Google";
             if (!workedProxyIsFound)
                 driver.Quit();
         }
         while (!workedProxyIsFound);
     }
     else
     {
         switch (document["settings"]["driver"].GetAttribute("name"))
         {
             case "GoogleChrome":
                 driver = new ChromeDriver(document["settings"]["driver"].GetAttribute("path"));
                 break;
             case "Firefox":
                 driver = new FirefoxDriver(new FirefoxBinary(), new FirefoxProfile(), TimeSpan.FromSeconds(120));
                 break;
             case "Opera":
                 driver = new OperaDriver(document["settings"]["driver"].GetAttribute("path"));
                 break;
             case "IE":
                 driver = new InternetExplorerDriver(document["settings"]["driver"].GetAttribute("path"));
                 break;
         }
     }
     return driver;
 }