Exposes the service provided by a native WebDriver server executable.
상속: IDisposable
예제 #1
0
        public FakeIEDriver(DriverService service, InternetExplorerOptions options, TimeSpan commandTimeout)
        {
Console.WriteLine("svc opt span2");
            this.UnitTestReport =
                //IEDriverConstructorOptions.ie_with_service_and_options_and_timespan.ToString();
                DriverServerConstructorOptions.with_service_and_options_and_timespan.ToString();
        }
예제 #2
0
        private QA.IWebDriver InitWebDriver(string cache_dir, bool loadImage = true, string useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36")
        {
            if (!Directory.Exists(cache_dir))
            {
                Directory.CreateDirectory(cache_dir);
            }
            QA.IWebDriver theDriver = null;
            switch (this.browser)
            {
            case Browsers.IE:
            {
                InternetExplorerDriverService driverService = InternetExplorerDriverService.CreateDefaultService(Application.StartupPath + "\\Drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;
                QA.IE.InternetExplorerOptions _ieOptions = new QA.IE.InternetExplorerOptions();
                _ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                theDriver  = new QA.IE.InternetExplorerDriver(driverService, _ieOptions);
                _ProcessID = driverService.ProcessId;
            }; break;

            case Browsers.Chrome:
            {
                ChromeDriverService driverService = ChromeDriverService.CreateDefaultService(Application.StartupPath + "\\Drivers\\");
                driverService.Port = new Random().Next(1000, 2000);
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;
                ChromeOptions options = new QA.Chrome.ChromeOptions();
                options.AddArgument("--window-size=" + Screen.PrimaryScreen.WorkingArea.Width + "x" + Screen.PrimaryScreen.WorkingArea.Height);
                options.AddArgument("--disable-gpu");
                options.AddArgument("--disable-extensions");
                options.AddArgument("--no-sandbox");
                options.AddArgument("--disable-dev-shm-usage");
                options.AddArgument("--disable-java");
                options.AddArgument("--user-agent=" + useragent);
                options.AddArgument(@"--user-data-dir=" + cache_dir);
                if (loadImage == false)
                {
                    options.AddUserProfilePreference("profile.managed_default_content_settings.images", 2);        //不加载图片
                }
                theDriver  = new QA.Chrome.ChromeDriver(driverService, options, TimeSpan.FromSeconds(240));
                _ProcessID = driverService.ProcessId;
            };
                break;

            case Browsers.Firefox:
            {
                var driverService = FirefoxDriverService.CreateDefaultService(Application.StartupPath + "\\Drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;
                FirefoxProfile profile = new FirefoxProfile();
                if (loadImage == false)
                {
                    profile.SetPreference("permissions.default.image", 2);
                    // 关掉flash
                    profile.SetPreference("dom.ipc.plugins.enabled.libflashplayer.so", false);
                }
                FirefoxOptions options = new FirefoxOptions();
                options.Profile = profile;
                theDriver       = new QA.Firefox.FirefoxDriver(driverService, options, TimeSpan.FromMinutes(240));
                _ProcessID      = driverService.ProcessId;
            };
                break;

            case Browsers.Safari:
            {
                SafariDriverService driverService = SafariDriverService.CreateDefaultService(Application.StartupPath + "\\Drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds         = driverService;
                theDriver  = new QA.Safari.SafariDriver(driverService);
                _ProcessID = driverService.ProcessId;
            };
                break;

            default:
            {
                QA.IE.InternetExplorerOptions _ieOptions = new QA.IE.InternetExplorerOptions();
                _ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                theDriver = new QA.IE.InternetExplorerDriver(_ieOptions);
            };
                break;
            }
            //theDriver.Manage().Window.Maximize();
            return(theDriver);
        }
예제 #3
0
 public FakeChromeDriver(DriverService service, ChromeOptions options, TimeSpan commandTimeout)
 {
     UnitTestReport =
         //ChromeDriverConstructorOptions.chrome_with_service_and_options_and_timespan.ToString();
         DriverServerConstructorOptions.WithServiceAndOptionsAndTimespan.ToString();
 }
예제 #4
0
        private void SetWebDriverToIE()
        {
            var driverPath = AppConfiguration.BrowserDirectory + UtilityHelpers._separator + "InternetExplorer" + UtilityHelpers._separator + _ieDir;
            _service = InternetExplorerDriverService.CreateDefaultService(driverPath);
            var _settings = new InternetExplorerOptions {
                IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                EnableNativeEvents = true,
                IgnoreZoomLevel = true
            };

            try
            {
                _service.Start();
            }
            catch (DriverServiceNotFoundException err)
            {
                throw new DriverServiceNotFoundException(err.Message);
            }

            _capabilities = DesiredCapabilities.InternetExplorer();
            WebDriver = new RemoteWebDriver(_service.ServiceUrl, _capabilities);
        }
예제 #5
0
        private void SetWebDriverToChrome()
        {
            var driverPath = AppConfiguration.BrowserDirectory + UtilityHelpers._separator + "Chrome" + UtilityHelpers._separator + _chromeDir;
            _service = ChromeDriverService.CreateDefaultService(driverPath);

            try
            {
                _service.Start();
            }
            catch (DriverServiceNotFoundException err)
            {
                throw new DriverServiceNotFoundException(err.Message);
            }

            _capabilities = DesiredCapabilities.Chrome();
            WebDriver = new RemoteWebDriver(_service.ServiceUrl, _capabilities);
        }
        /*
         * 
         * METHODS
         * 
         */


        /// <summary>
        /// Main "Work" Thread
        /// Does all scraping work. To be used in another Thread to prevent Form locking.
        /// </summary>
        private void doScrapingWork()
        {
            // Clear output window
            this.setText("");

            // Check if the webClient has already been initialized
            if (this.webClient != null)
            {
                // If so close WebClient
                this.appendText("Closing WebClient!" + Environment.NewLine);
                webClient.Quit();
            }

            // Checks if Debug mode boolean is set
            if (debug)
            {
                // Set Debug WebClient if so

                // Set WebClient Service options
                srvc = ChromeDriverService.CreateDefaultService();
                srvc.HideCommandPromptWindow = true;

                // Initialize WebClient
                this.appendText("Starting WebClient" + Environment.NewLine);
                webClient = new ChromeDriver((ChromeDriverService)srvc);
            }
            else
            {
                // Set Regular WebClient if not

                // Set WebClient Service options
                srvc = PhantomJSDriverService.CreateDefaultService();
                srvc.HideCommandPromptWindow = true;

                // Set WebClient options
                PhantomJSOptions opts = new PhantomJSOptions();
                opts.AddAdditionalCapability("web-security", false);
                opts.AddAdditionalCapability("ssl-protocol", "any");
                opts.AddAdditionalCapability("ignore-ssl-errors", true);
                opts.AddAdditionalCapability("webdriver-loglevel", "DEBUG");

                // Initialize WebClient
                this.appendText("Starting WebClient" + Environment.NewLine);
                webClient = new PhantomJSDriver((PhantomJSDriverService)srvc, opts);
            }

            // Set WebClient pag load timeout to 10 seconds
            webClient.Manage().Timeouts().SetPageLoadTimeout(new TimeSpan(0, 0, 10));

            // Open DC MyCampus login page
            this.appendText("Loading MyCampus login page" + Environment.NewLine);
            webClient.Navigate().GoToUrl("http://www.durhamcollege.ca/mycampus/");

            // Pass username and password to page
            this.appendText("Inputting login details" + Environment.NewLine);
            webClient.ExecuteScript("document.cplogin.user.value='" + txtUsername.Text + "';");
            webClient.ExecuteScript("document.cplogin.pass.value='" + txtPassword.Text + "';");

            // Click login button
            this.appendText("Logging in" + Environment.NewLine);
            webClient.FindElement(By.Id("submit-text-search")).Click();

            // Set Campus based on ComboBox
            string homeAnchorText;

            switch (this.getCampusSelection())
            {
                case "Durham College":
                    homeAnchorText = "DC Home";
                    break;
                case "UOIT":
                    homeAnchorText = "UOIT Home";
                    break;
                default:
                    homeAnchorText = "DC Home";
                    break;
            }

            // Search for Campus "Home" Anchor
            IReadOnlyCollection<IWebElement> homeAnchor = webClient.FindElements(By.LinkText(homeAnchorText));

            // Check if login succeeded based on the "Home" Anchor
            if (homeAnchor.Count > 0)
            {
                // Click Anchor to load Student Information
                webClient.FindElement(By.LinkText(homeAnchorText)).Click();

                this.appendText("Login successful" + Environment.NewLine);
            }
            else
            {
                // Login unsuccessful
                this.appendText("Login Unsuccessful!" + Environment.NewLine);

                // Enable go button
                this.setButtonEnabled(true);

                // End Thread
                return;
            }

            // Select / Click Timetable Anchor
            this.appendText("Clicking 'Student schedule' link" + Environment.NewLine);
            webClient.FindElement(By.LinkText("Student schedule by day and time")).Click();

            // Select Timetable IFrame
            this.appendText("Switch to Content IFrame" + Environment.NewLine);
            webClient.SwitchTo().Frame("content");

            // Select / Click Second Timetable Anchor 
            this.appendText("Clicking Second 'Student schedule' link" + Environment.NewLine);
            webClient.FindElement(By.PartialLinkText("Student Schedule")).Click();

            // Create empty Calendar with default settings
            this.appendText("Initialize blank ICalendar" + Environment.NewLine);
            iCalendar ical = new iCalendar();

            // Set required properties to the Calendar
            this.appendText("Set ICalendar properties" + Environment.NewLine);
            ical.ProductID = "-//Scott Chi//iCalendar 1.0//EN";
            ical.Version = "2.0";
            ical.Scale = "GREGORIAN";

            // Initialize 
            this.appendText("Initialize Dictionary" + Environment.NewLine);
            Dictionary<string, Dictionary<string, string>> calendarMap = new Dictionary<string, Dictionary<string, string>>();

            int lastPage = 0;

            // Add all classes in the week
            this.appendText("Start grabbing class info from each week" + Environment.NewLine);
            do
            {
                // Grab Weekstart from Timetable IFrame
                String weekStart = webClient.FindElement(By.XPath("//span[@class='fieldlargetext']")).Text.Substring(8);

                // Loop through Timetable Anchors
                foreach (var calendarAnchor in webClient.FindElements(By.XPath("//table[@class='bordertable']/tbody//tr//td//a")))
                {
                    // Grab class from Anchor
                    string clss = calendarAnchor.Text.Split('\r')[0];
                    // Grab Anchor Link from Anchor
                    string href = calendarAnchor.GetAttribute("href");

                    // Check if there are keys for this week yet
                    if (!calendarMap.ContainsKey(weekStart))
                    {
                        // If not initialize week in Dictionary
                        calendarMap.Add(weekStart, new Dictionary<string, string>());
                    }

                    // Check if the class has already been added to the week entry
                    if (calendarMap.ContainsKey(weekStart) && calendarMap[weekStart].ContainsKey(clss))
                    {
                        // If so skip it
                        continue;
                    }

                    // Add class to week
                    calendarMap[weekStart].Add(clss, href);
                }

                IReadOnlyCollection<IWebElement> nextPage = webClient.FindElements(By.XPath("//table[@class='plaintable']/tbody//tr//p[@class='rightaligntext']//a"));

                // Check if this is last page
                if (nextPage.Count > 0)
                {
                    // If not click to next page
                    nextPage.First().Click();
                }

                // Check if next week will be last week
                if (webClient.FindElements(By.XPath("//table[@class='plaintable']/tbody//tr//p[@class='rightaligntext']//a")).Count == 0)
                {
                    // If so increment the last page (only works once)
                    lastPage++;
                    continue;
                }
            }
            // While there is a "Next Week" or if page is the "Last Page" anchor add all classes in week
            while (webClient.FindElements(By.XPath("//table[@class='plaintable']/tbody//tr//p[@class='rightaligntext']//a")).Count > 0 || lastPage == 1);

            // Intitilize week count
            int weekCount = 1;

            // Loop through weeks
            this.appendText("Loop through grabbed data" + Environment.NewLine);
            foreach (KeyValuePair<string, Dictionary<string, string>> dictEntry in calendarMap)
            {
                this.appendText("Parsing information from week " + weekCount + Environment.NewLine);

                // Grab week start date
                string weekStart = dictEntry.Key;

                // Loop through classes
                foreach (KeyValuePair<string, string> entry in dictEntry.Value)
                {
                    // Initialize class name
                    string clss = entry.Key;

                    // Go to class url
                    webClient.Navigate().GoToUrl(entry.Value);

                    // Initialize time, room, teacherName variables
                    string time = "", room = "", teacherName = "";

                    // Loop through Timetable rows
                    foreach (var row in webClient.FindElements(By.XPath("//table[@class='bordertable' and caption/.='Scheduled Meeting Times']/tbody//tr")))
                    {
                        // Check if row is header row or if this class has already been added if either is true continue loop
                        if (row.Text.Contains("Type"))
                        {
                            continue;
                        }

                        // Initialize row counter and date advancer
                        int i = 0, advDate = 0;

                        // Loop through row cells
                        foreach (var dataCell in row.FindElements(By.TagName("td")))
                        {
                            // Switch that checks which column the data corresponds to
                            switch (i)
                            {
                                // Type of class, not currently used
                                case 0:
                                    break;
                                // Time field
                                case 1:
                                    time = dataCell.Text;
                                    break;
                                // Days of week field
                                case 2:
                                    // Initialize dayOfWeek variable
                                    String dayOfWeek = dataCell.Text;
                                    // Switch that checks which day of the week it is
                                    // Changes date advancer to match day of week
                                    // e.g. Monday = no advancement, Tuesday = one day advancement
                                    switch (dayOfWeek)
                                    {
                                        case "M":
                                            break;
                                        case "T":
                                            advDate = 1;
                                            break;
                                        case "W":
                                            advDate = 2;
                                            break;
                                        case "R":
                                            advDate = 3;
                                            break;
                                        case "F":
                                            advDate = 4;
                                            break;
                                    }
                                    break;
                                // Room field
                                case 3:
                                    room = dataCell.Text;
                                    break;
                                // Date range field, not currently in use
                                case 4:
                                    break;
                                // Schedule type field, not currently used
                                case 5:
                                    //scheduleType = dataCell.getTextContent();
                                    break;
                                // Teacher name field
                                case 6:
                                    teacherName = dataCell.Text.Split('(')[0].Trim();
                                    break;
                            }

                            // Increment row counter
                            i++;
                        }

                        // Create the Events title class name with room number in parentheses
                        String[] classArray = room.Split(' ');
                        String title = clss + "(" + classArray[classArray.Length - 1] + ")";
                        // Create the Events description each item is on a new line
                        // Includes class name, time of class, room number, teachers name
                        String description = clss + Environment.NewLine + time + Environment.NewLine + room + Environment.NewLine + teacherName;

                        // Create a Date formatter that will be used to format a time string
                        //string format = "MMM dd, yyyy hh:mm aa";

                        // Split the time range
                        String[] splitTime = time.Split('-');

                        // Add the start and end times to the date, parse it and convert it to a Date object
                        DateTime startDate;
                        DateTime endDate;

                        if (!(DateTime.TryParse(weekStart + " " + splitTime[0].Trim(), out startDate) &&
                        DateTime.TryParse(weekStart + " " + splitTime[1].Trim(), out endDate)))
                        {
                            //TODO Print Message.
                            return;
                        }

                        // Add the date advance to the date
                        // 86400000 milliseconds = 1 day = 24 hours
                        DateTime startDateTime = startDate.AddDays(advDate);
                        DateTime endDateTime = endDate.AddDays(advDate);

                        // Pass variables to add event to calendar function
                        addEventToCalendar(ical, startDateTime, endDateTime, description, title);
                    }
                }

                this.appendText(dictEntry.Value.Count + " events added from week " + weekCount + Environment.NewLine);

                weekCount++;
            }

            // Write calendar to file
            this.appendText(ical.Calendar.Events.Count + " events being written to file" + Environment.NewLine + "'" + txtFileLocation.Text + "'" + Environment.NewLine);
            iCalendarSerializer serializer = new iCalendarSerializer();
            serializer.Serialize(ical, txtFileLocation.Text);

            // Quite WebClient
            this.appendText("Closing WebClient!" + Environment.NewLine);
            webClient.Quit();

            // Enable Go button
            this.setButtonEnabled(true);
        }
예제 #7
0
        private QA.IWebDriver InitWebDriver()
        {
            QA.IWebDriver theDriver = null;
            switch (this.browser)
            {
            case Browsers.IE:
            {
                InternetExplorerDriverService driverService = InternetExplorerDriverService.CreateDefaultService(Application.StartupPath + "\\drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;
                QA.IE.InternetExplorerOptions _ieOptions = new QA.IE.InternetExplorerOptions();
                _ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                theDriver = new QA.IE.InternetExplorerDriver(driverService, _ieOptions);
                ProcessID = driverService.ProcessId;
            }; break;

            case Browsers.PhantomJS:
            {
                PhantomJSDriverService driverService = PhantomJSDriverService.CreateDefaultService(Application.StartupPath + "\\Drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;

                theDriver = new QA.PhantomJS.PhantomJSDriver(driverService);
            }; break;

            case Browsers.Chrome:
            {
                ChromeDriverService driverService = ChromeDriverService.CreateDefaultService(Application.StartupPath + "\\drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;

                ChromeOptions options = new QA.Chrome.ChromeOptions();
                options.AddUserProfilePreference("profile.managed_default_content_settings.images", _IsLoadPicture ? 1 : 2);
                options.AddUserProfilePreference("profile.managed_default_content_settings.javascript", _IsLoadJS ? 1 : 2);

                //options.AddArgument(@"--user-data-dir=" + cache_dir);
                //string dir = string.Format(@"user-data-dir={0}", ConfigManager.GetInstance().UserDataDir);
                //options.AddArguments(dir);

                //options.AddArgument("--no-sandbox");
                //options.AddArgument("--disable-dev-shm-usage");
                //options.AddArguments("--disable-extensions"); // to disable extension
                //options.AddArguments("--disable-notifications"); // to disable notification
                //options.AddArguments("--disable-application-cache"); // to disable cache
                try
                {
                    if (_timeout == 60)
                    {
                        theDriver = new QA.Chrome.ChromeDriver(driverService, options, new TimeSpan(0, 0, 40));
                    }
                    else
                    {
                        theDriver = new QA.Chrome.ChromeDriver(driverService, options, new TimeSpan(0, 0, _timeout));
                    }
                }
                catch (Exception ex)
                {
                }
                ProcessID = driverService.ProcessId;
            }; break;

            case Browsers.Firefox:
            {
                var driverService = FirefoxDriverService.CreateDefaultService(Application.StartupPath + "\\drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;

                FirefoxProfile profile = new FirefoxProfile();
                try
                {
                    if (_doproxy == "1")
                    {
                        string proxy = "";
                        try
                        {
                            if (_IsUseNewProxy == false)
                            {
                                proxy = GetProxyA();
                            }
                            else
                            {
                                //TO DO 获取芝麻代理
                                hi.URL = "http:......?你的代理地址";        // ConfigManager.GetInstance().ProxyUrl;
                                hr     = hh.GetContent(hi);
                                if (hr.StatusCode == System.Net.HttpStatusCode.OK)
                                {
                                    if (hr.Content.Contains("您的套餐余量为0"))
                                    {
                                        proxy = "";
                                    }
                                    if (hr.Content.Contains("success") == false)
                                    {
                                        proxy = "";
                                    }

                                    JObject j = JObject.Parse(hr.Content);
                                    foreach (var item in j)
                                    {
                                        foreach (var itemA in item.Value)
                                        {
                                            if (itemA.ToString().Contains("expire_time"))
                                            {
                                                if (DateTime.Now.AddHours(2) < DateTime.Parse(itemA["expire_time"].ToString()))
                                                {
                                                    proxy = itemA["ip"].ToString() + ":" + itemA["port"].ToString();
                                                    break;
                                                }
                                            }
                                        }
                                        if (proxy != "")
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }

                        if (proxy != "" && proxy.Contains(":"))
                        {
                            OpenQA.Selenium.Proxy proxyF = new OpenQA.Selenium.Proxy();
                            proxyF.HttpProxy = proxy;
                            proxyF.FtpProxy  = proxy;
                            proxyF.SslProxy  = proxy;
                            profile.SetProxyPreferences(proxyF);
                            // 使用代理
                            profile.SetPreference("network.proxy.type", 1);
                            //ProxyUser-通行证书 ProxyPass-通行密钥
                            profile.SetPreference("username", "你的账号");
                            profile.SetPreference("password", "你的密码");

                            // 所有协议公用一种代理配置,如果单独配置,这项设置为false
                            profile.SetPreference("network.proxy.share_proxy_settings", true);

                            // 对于localhost的不用代理,这里必须要配置,否则无法和webdriver通讯
                            profile.SetPreference("network.proxy.no_proxies_on", "localhost");
                        }
                    }
                }
                catch (Exception ex)
                {
                }

                //profile.SetPreference("permissions.default.image", 2);
                // 关掉flash
                profile.SetPreference("dom.ipc.plugins.enabled.libflashplayer.so", false);
                FirefoxOptions options = new FirefoxOptions();
                options.Profile = profile;
                theDriver       = new QA.Firefox.FirefoxDriver(driverService, options, TimeSpan.FromMinutes(1));
                ProcessID       = driverService.ProcessId;
            }; break;

            case Browsers.Safari:
            {
                SafariDriverService driverService = SafariDriverService.CreateDefaultService(Application.StartupPath + "\\Drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds        = driverService;
                theDriver = new QA.Safari.SafariDriver(driverService);
                ProcessID = driverService.ProcessId;
            }; break;

            default:
            {
                QA.IE.InternetExplorerOptions _ieOptions = new QA.IE.InternetExplorerOptions();
                _ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                theDriver = new QA.IE.InternetExplorerDriver(_ieOptions);
            }; break;
            }
            return(theDriver);
        }
예제 #8
0
        private void SetWebDriverToIE()
        {
            var driverExePath = _driverPaths + "ie" + Path.DirectorySeparatorChar + _ieDriverServer;
            _driverservice = InternetExplorerDriverService.CreateDefaultService(driverExePath);
            var settings = new InternetExplorerOptions
            {
                IntroduceInstabilityByIgnoringProtectedModeSettings = true,
                EnsureCleanSession = true
            };

            try
            {
                _driverservice.Start();
            }
            catch (Exception err)
            {
                throw new DriverServiceNotFoundException(err.Message);
            }

            _capabilities = DesiredCapabilities.InternetExplorer();
            SetAdditionalCapabilities();

            WebDriver = new ScreenShotRemoteWebDriver(_driverservice.ServiceUrl, _capabilities);
        }
예제 #9
0
        private void SetWebDriverToChrome()
        {
            var driverExePath = _driverPaths + "chrome" + Path.DirectorySeparatorChar + _chromedriver;
            _driverservice = ChromeDriverService.CreateDefaultService(driverExePath);
            var settings = new ChromeOptions
            {
                BinaryLocation = "",
                LeaveBrowserRunning = true
            };

            try
            {
                _driverservice.Start();
            }
            catch (Exception err)
            {
                throw new DriverServiceNotFoundException(err.Message);
            }

            _capabilities = DesiredCapabilities.Chrome();
            SetAdditionalCapabilities();

            WebDriver = new ScreenShotRemoteWebDriver(_driverservice.ServiceUrl, _capabilities);
        }