Esempio n. 1
0
        public static IWebDriver GetInstance()
        {
            if (driver == null)
            {
                TestConfigurations configs = TestConfigurations.GetInstance();

                if (TestConfigurations.Browser == chrome)
                {
                    ChromeOptions chromeOptions = new ChromeOptions();
                    chromeOptions.AcceptInsecureCertificates = true;
                    driver = new ChromeDriver();
                }
                else if (TestConfigurations.Browser == firefox)
                {
                    var            profileManager = new FirefoxProfileManager();
                    FirefoxProfile profile        = profileManager.GetProfile("myNewProfile");
                    profile.AcceptUntrustedCertificates = true;


                    FirefoxOptions options = new FirefoxOptions();
                    options.Profile = profile;
                    driver          = new FirefoxDriver(options);
                }
                else if (TestConfigurations.Browser == internetExplorer)
                {
                    driver = new InternetExplorerDriver();
                }
                else
                {
                    throw new Exception("Invalid browser in the settings");
                }
            }
            return(driver);
        }
Esempio n. 2
0
        private void OpenBrowser()
        {
            FirefoxProfileManager profilemanager = new FirefoxProfileManager();
            FirefoxProfile        profile        = (profilemanager.GetProfile("123"));//pathsToProfiles[0]);

            driver = new FirefoxDriver(new FirefoxBinary(@"FF\firefox.exe"), profile);
        }
Esempio n. 3
0
        public IWebDriver StartBrowser(string browserType)
        {
            switch (browserType)
            {
            case ("Chrome"):
                driver = new ChromeDriver();
                return(driver);

                break;

            case ("Firefox"):
                //FIREFOX with lame untrusted certificate exception workaround
                FirefoxProfileManager ffprofmanager  = new FirefoxProfileManager();
                FirefoxProfile        firefoxProfile = ffprofmanager.GetProfile(firefoxProfileName);
                firefoxProfile.AcceptUntrustedCertificates      = true;
                firefoxProfile.AssumeUntrustedCertificateIssuer = false;
                return(new FirefoxDriver(firefoxProfile));

                break;

            default:
                driver = new ChromeDriver();
                return(driver);
            }
            return(driver);
        }
Esempio n. 4
0
        };                                                            // Keyword list
        static void Main(string[] args)
        {
            #region Input
            Console.Write("Please type your direction to text file: ");
            string link_dir = Console.ReadLine();
            string tmp;
            do
            {
                Console.Write("Please insert your key word (To stop type 'Done'): ");
                tmp = Console.ReadLine();
                if (tmp != "Done")
                {
                    key_lists.Add(tmp);
                }
            } while (tmp != "Done");
            #endregion

            // Solution
            FirefoxProfileManager profile_manager = new FirefoxProfileManager();
            FirefoxProfile        profile         = profile_manager.GetProfile("Selenium");
            // "Selenium" is my profile name in Firefox, you need to create something similar otherwise Firefox will use Default profile
            IWebDriver             driver = new FirefoxDriver(profile);
            string                 line;
            System.IO.StreamReader file = new System.IO.StreamReader(link_dir);             //Link to text file
            while ((line = file.ReadLine()) != null)
            {
                Process(line, driver);
            }
            file.Close();
            driver.Close();
            Console.ReadLine();
        }
Esempio n. 5
0
        public static void GrabAllLinks()
        {
            var profileManager = new FirefoxProfileManager();
            var profile        = profileManager.GetProfile("Test");
            var firefoxService = FirefoxDriverService.CreateDefaultService();
            var options        = new FirefoxOptions()
            {
                Profile = profile
            };
            var driver = new FirefoxDriver(firefoxService, options, new TimeSpan(0, 0, 30));

            driver.Navigate().GoToUrl("http://audioclub.top/");
            var htmlDocument = new HtmlDocument();

            htmlDocument.LoadHtml(driver.PageSource);
            var elements = htmlDocument.DocumentNode.SelectNodesNoFail(".//li[contains(@class,'cat-item')]//a");
            var links    = new HashSet <string>();

            foreach (var element in elements)
            {
                links.Add(Regex.Match(element.Attributes["href"].Value, @"http://audioclub.top/category/([^/]*)/").Groups[1].Captures[0].Value);
                Console.WriteLine("Found company {0}", element.InnerText);
            }
            links.Add("plugin");
            var contents = links.Aggregate("", (current, company) => current + GrabLinks(company, driver));

            File.WriteAllText($@"{Paths.ListsPath}\All.txt", contents);
        }
        public void SetupTest()
        {
            // 7. Use specific Firefox Profile
            var            profileManager = new FirefoxProfileManager();
            FirefoxProfile profile        = profileManager.GetProfile("HARDDISKUSER");
            var            firefoxOptions = new FirefoxOptions();

            firefoxOptions.Profile = profile;
            _driver = new FirefoxDriver(firefoxOptions);

            // 7.1. Set Chrome Options.
            ChromeOptions options = new ChromeOptions();

            options.AcceptInsecureCertificates = true;
            options.UnhandledPromptBehavior
            ////// set some options
            ////DesiredCapabilities dc = DesiredCapabilities.Chrome();
            ////dc.SetCapability(ChromeOptions.Capability, options);
            ////IWebDriver driver = new RemoteWebDriver(dc);
            // 8. Turn off Java Script
            ////FirefoxProfileManager profileManager = new FirefoxProfileManager();
            ////FirefoxProfile profile = profileManager.GetProfile("HARDDISKUSER");
            ////profile.SetPreference("javascript.enabled", false);
            ////this.driver = new FirefoxDriver(profile);
            ////this.driver = new FirefoxDriver();
            ////var options = new InternetExplorerOptions();
            ////options.EnsureCleanSession = true;
            ////options.IgnoreZoomLevel = true;
            ////options.EnableNativeEvents = true;
            ////options.PageLoadStrategy = InternetExplorerPageLoadStrategy.Eager;
            ////this.driver = new InternetExplorerDriver(@"D:\Projects\PatternsInAutomation.Tests\WebDriver.Series.Tests\Drivers", options);
                _driver = new FirefoxDriver();
            _driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30);
        }
Esempio n. 7
0
        public void EscolherBrowser(string browser)
        {
            switch (browser)
            {
            case "Chrome":
                var options = new ChromeOptions();
                options.AddUserProfilePreference("credentials_enable_service", false);
                options.AddUserProfilePreference("password_manager_enabled", false);
                Driver = new ChromeDriver(options);
                ConfigurarBrowser();
                ScenarioContext.Current["Driver"] = Driver;
                break;

            case "Firefox":
                var            profilePadrao = new FirefoxProfileManager();
                FirefoxProfile profile       = profilePadrao.GetProfile("Selenium");
                Driver = new FirefoxDriver(profile);
                ConfigurarBrowser();
                ScenarioContext.Current["Driver"] = Driver;
                break;

            case "IE":
                Driver = new InternetExplorerDriver();
                ConfigurarBrowser();
                ScenarioContext.Current["driver"] = Driver;
                break;

            default:
                Driver = new ChromeDriver();
                ConfigurarBrowser();
                ScenarioContext.Current["Driver"] = Driver;
                break;
            }
        }
Esempio n. 8
0
        private static FirefoxProfile GetFirefoxOption()
        {
            var FProfile = new FirefoxProfile();
            FirefoxProfileManager fxManager = new FirefoxProfileManager();

            FProfile = fxManager.GetProfile("default");
            return(FProfile);
        }
Esempio n. 9
0
        private static FirefoxProfile GetFirefoxProfile()
        {
            FirefoxProfile        profile = new FirefoxProfile();
            FirefoxProfileManager manager = new FirefoxProfileManager();

            profile = manager.GetProfile("chaaru1001");
            return(profile);
        }
Esempio n. 10
0
      private static FirefoxProfile GetFirefoxOptions()
      {
          var fOptions  = new FirefoxProfile();
          var fxManager = new FirefoxProfileManager();

          fOptions = fxManager.GetProfile("default");
          return(fOptions);
      }
Esempio n. 11
0
        private static FirefoxProfile GetFirefoxoptions()
        {
            FirefoxProfile        profile = new FirefoxProfile();
            FirefoxProfileManager manager = new FirefoxProfileManager();

            profile = manager.GetProfile("default");
            return(profile);
        }
Esempio n. 12
0
        private void InstaWorker(int accountId)
        {
            string listenBox1 = Convert.ToString(listBox1.Items[accountId]);

            string[] AccPwdMailPwd = listenBox1.Split(':');
            string   listenBox2    = Convert.ToString(listBox2.Items[accountId]);

            string[] ProxyPortLoginpPwdP = listenBox2.Split(':');
            var      profileManager      = new FirefoxProfileManager();

            FirefoxProfile profileInstagram = profileManager.GetProfile("Selenium");

            String PROXY = ProxyPortLoginpPwdP[0] + ":" + ProxyPortLoginpPwdP[1];

            Proxy proxy = new Proxy()
            {
                HttpProxy = PROXY,
                // FtpProxy = PROXY,
                // SslProxy = PROXY,
            };

            profileInstagram.SetProxyPreferences(proxy);


            FirefoxDriver browserInstagram = new FirefoxDriver(profileInstagram);

            Thread.Sleep(5000);

            browserInstagram.FindElement(By.XPath("//input[@name='username']"), 5).SendKeys(AccPwdMailPwd[0]);
            browserInstagram.FindElement(By.XPath("//input[@name='password']"), 5).SendKeys(AccPwdMailPwd[1]);                                               //ListBox1Item2(instapwd)
            browserInstagram.FindElement(By.XPath("//*[@id=\"react-root\"]//section//main//div//article//div//div[1]//div//form//span//button"), 5).Click(); // InstaLoginButton
                                                                                                                                                             // var cookies = listBox5.Items[accountId].ToString().Split(':');
                                                                                                                                                             // string[] CookMember = cookies[8].Split(';');
                                                                                                                                                             // string sessionId = cookies[9];
            browserInstagram.Navigate().GoToUrl("https://" + ProxyPortLoginpPwdP[2] + ":" + ProxyPortLoginpPwdP[3] + "@instagram.com/accounts/login/");      //Good  http://username:[email protected]
            Thread.Sleep(5000);
            browserInstagram.Navigate().GoToUrl("https://" + ProxyPortLoginpPwdP[2] + ":" + ProxyPortLoginpPwdP[3] + "@/p/BXioaw6B9uX/?taken-by=l4paley");   //Good  http://username:[email protected]
            Thread.Sleep(3000);
            browserInstagram.FindElement(By.XPath("//*[@id=\"react-root\"]//section//main//div//div//article//div[2]//section[1]//a[1]")).Click();
            Thread.Sleep(500);
            browserInstagram.Close();
            //browserInstagram.WebStorage.SessionStorage.SetItem

            //browserInstagram.Manage().Cookies.DeleteAllCookies();

            //browserInstagram.Manage().Cookies.AddCookie(new Cookie("sessionid", //sessionId));

            /*foreach (var Cookie in CookMember)
             * {
             *  var data = Cookie.Split(new[] { '=' }, 2);
             *  browserInstagram.Manage().Cookies.AddCookie(new Cookie(data[0].Trim(), data[1].Trim()));
             *  Console.WriteLine(data[0].Trim());
             *  Console.WriteLine(data[1].Trim());
             * }    *///Browser2.Navigate().GoToUrl("https://" + ProxyPortLoginpPwdP[2] + ":" + ProxyPortLoginpPwdP[3] + "@mail.ru"); //Good
            //  browserInstagram.Navigate().GoToUrl("https://" + ProxyPortLoginpPwdP[2] + ":" + ProxyPortLoginpPwdP[3] + "@instagram.com");

            Thread.Sleep(3000);
        }
        public DriverFixture(IMessageSink messageSink)
        {
            try
            {
                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

                var testWebBrowser = Environment.GetEnvironmentVariable("TestWebBrowser") ?? "Chrome";
                messageSink.OnMessage(new DiagnosticMessage($"TestWebBrowser = {testWebBrowser}"));

                if (testWebBrowser == "Firefox")
                {
                    var profiles = new FirefoxProfileManager();
                    var profile  = profiles.GetProfile("selenium");

                    messageSink.OnMessage(new DiagnosticMessage("Profiles:"));
                    foreach (var existingProfile in profiles.ExistingProfiles)
                    {
                        messageSink.OnMessage(new DiagnosticMessage($"Profile = {existingProfile}"));
                    }

                    var options = new FirefoxOptions {
                        Profile = profile
                    };
                    options.SetLoggingPreference(LogType.Browser, LogLevel.All);

                    Driver = new FirefoxDriver(FirefoxDriverService.CreateDefaultService(Environment.CurrentDirectory),
                                               new FirefoxOptions {
                        Profile = profile
                    },
                                               TimeSpan.FromSeconds(30));
                }
                else if (testWebBrowser == "IE")
                {
                    Driver = new InternetExplorerDriver(Environment.CurrentDirectory);
                }
                else if (testWebBrowser == "Chrome")
                {
                    Driver = new ChromeDriver(Environment.CurrentDirectory);
                }

                Driver.Manage().Window.Position = new Point(0, 0);
                Driver.Manage().Window.Size = new Size(1920, 1080);

                Driver.Url = Environment.GetEnvironmentVariable("WebUrl") ?? "http://localhost:5000/";
                messageSink.OnMessage(new DiagnosticMessage($"WebUrl = {Driver?.Url ?? "NULL"}"));

                Driver.Manage().Timeouts().ImplicitWait           = TimeSpan.FromSeconds(10);
                Driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(10);
                Driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(10);

                Driver.FindElement(By.TagName("app-root"));
            }
            catch (Exception ex)
            {
                messageSink.OnMessage(new DiagnosticMessage($"Exception while initializing driver: {ex.Message}"));
                Driver?.Dispose();
            }
        }
Esempio n. 14
0
        //public BaseClass(string browser)
        //{
        //    browser = ConfigReader.GetBrowser;
        //}
        public static FirefoxProfile GetFirefoxptions()
        {
            FirefoxProfile        profile = new FirefoxProfile();
            FirefoxProfileManager manager = new FirefoxProfileManager();

            profile = manager.GetProfile("default");
            //  Logger.Info(" Using Firefox Profile ");
            return(profile);
        }
Esempio n. 15
0
        private static void Main(string[] args)
        {
            // creates a session that uses my Firefox profile.

            FirefoxProfileManager profileManager = new FirefoxProfileManager();
            FirefoxProfile        profile        = profileManager.GetProfile("Ryan");
            IWebDriver            driver         = new FirefoxDriver(profile);


            driver.Url = "http://www.google.com";


            var searchBox = driver.FindElement(By.Id("lst-ib"));

            //Looks for the correct site.


            searchBox.SendKeys("animefreak.tv");

            searchBox.Submit();

            var searchButton = driver.FindElement(By.ClassName("lsb"));

            searchButton.Click();
            System.Threading.Thread.Sleep(1000);
            // Click on the first result for AnimeFreak.tv
            driver.FindElement(By.XPath("id('rso')/div/div[1]/div/h3/a")).Click();

            System.Threading.Thread.Sleep(1000);
            driver.FindElement(By.XPath("id('submenu')/ul/li[3]/a")).Click();
            System.Threading.Thread.Sleep(1000);

            //Selects "O" from the list
            driver.FindElement(By.XPath("id('primary')/div/div[3]/div[1]/div/div/span[20]/a")).Click();
            System.Threading.Thread.Sleep(1000);
            //Goes to OnePiece

            driver.FindElement(By.XPath(".//*[@id='primary']/div/div[3]/div[2]/table/tbody/tr[9]/td/a")).Click();
            System.Threading.Thread.Sleep(1000);

            //Goes to Episode 422
            //driver.FindElement(By.XPath("id('page')/div[5]/div[2]/div[2]/div/ul/li[418]/a")).Click();
            driver.FindElement(By.XPath("id('page')/div[5]/div[2]/div[2]/div/ul/li[1]/a")).Click();
            System.Threading.Thread.Sleep(1000);


            do
            {
                if (!driver.FindElement(By.XPath("id('primary')/div/div[3]/div/a[2]")).Enabled)
                {
                }
                driver.FindElement(By.ClassName("page-next")).Click();
            } while (driver.FindElement(By.XPath("id('primary')/div/div[3]/div/a[2]")).Enabled);

            driver.Close();
        }
Esempio n. 16
0
        public static IWebDriver SetUpFirefoxDriver()
        {
            //FIREFOX with lame untrusted certificate exception workaround
            FirefoxProfileManager ffprofmanager  = new FirefoxProfileManager();
            FirefoxProfile        firefoxProfile = ffprofmanager.GetProfile(firefoxProfileName);

            firefoxProfile.AcceptUntrustedCertificates      = true;
            firefoxProfile.AssumeUntrustedCertificateIssuer = false;
            return(new FirefoxDriver(firefoxProfile));
        }
Esempio n. 17
0
        public static FirefoxProfile CookieProfiles(string cookieProfile)
        {
            var profile = new FirefoxProfile();

            if (cookieProfile != string.Empty)
            {
                var myProfile = new FirefoxProfileManager();
                profile = myProfile.GetProfile(cookieProfile);
            }
            return(profile);
        }
        private static FirefoxProfile GetFirefoxProfile()
        {
            FirefoxProfile        profile = new FirefoxProfile();
            FirefoxProfileManager manager = new FirefoxProfileManager();

            profile.SetPreference("webdriver.gecko.driver", @"C:\Users\ramon\Downloads\geckodriver.exe");

            profile = manager.GetProfile("default");

            return(profile);
        }
        public static FirefoxDriver CreateFirefoxDriverWithDefaultProfile()
        {
            var            profileManager = new FirefoxProfileManager();
            FirefoxProfile profile        = profileManager.GetProfile("default");
            FirefoxOptions firefoxOptions = new FirefoxOptions();

            firefoxOptions.Profile = profile;
            var firefoxDriver = new FirefoxDriver(firefoxOptions);

            return(firefoxDriver);
        }
        public static FirefoxOptions GetOptions()
        {
            FirefoxProfileManager manager = new FirefoxProfileManager();

            FirefoxOptions options = new FirefoxOptions()
            {
                Profile = manager.GetProfile("default"),
                AcceptInsecureCertificates = true,
            };

            return(options);
        }
Esempio n. 21
0
        public static void Start(TestContext context)
        {
            FirefoxProfileManager profileManager = new FirefoxProfileManager();
            FirefoxProfile        profile        = profileManager.GetProfile("profileToolsQA");

            WebDriver        = new FirefoxDriver(profile);
            TestUserName     = "******";
            TestUserPassword = "******";
            //TestApplicationBaseUrl = @"https://*****:*****@"C:\Temp\Powerfront\";
        }
Esempio n. 22
0
        private void OpenBrowser(object sender, DoWorkEventArgs e)
        {
            var manager   = new FirefoxProfileManager();
            var ffProfile = manager.GetProfile("default");
            var fds       = FirefoxDriverService.CreateDefaultService(MainWindow.panelOptions.FirefoxDriverPath);

            fds.HideCommandPromptWindow = true;
            var options = new FirefoxOptions();

            options.Profile = ffProfile;
            chrome          = new FirefoxDriver(fds, options, new TimeSpan(0, 2, 0));
            wait            = new WebDriverWait(chrome, new TimeSpan(0, 0, 5));
        }
        public IWebDriver StartBrowser(string browser)
        {
            Uri        testserver = new Uri(ConfigurationManager.ConnectionStrings["SeleniumServerUrl"].ConnectionString);
            IWebDriver driver;

            switch (browser)
            {
            case Chrome:
                driver = new ChromeDriver();
                break;

            case Firefox:
                FirefoxProfileManager myProfile = new FirefoxProfileManager();
                FirefoxProfile        profile   = myProfile.GetProfile("default");
                profile.SetPreference("network.cookie.cookieBehavior", 0);
                driver = new FirefoxDriver(profile);
                break;

            case Remotechrome:
                driver = new RemoteWebDriver(testserver, DesiredCapabilities.Chrome());
                break;

            case Remotefx:
                driver = new RemoteWebDriver(testserver, DesiredCapabilities.Firefox());
                break;

            case Remoteie:
                driver = new RemoteWebDriver(testserver, DesiredCapabilities.InternetExplorer());
                break;

            case Remoteunitjs:
                driver = new RemoteWebDriver(testserver, DesiredCapabilities.HtmlUnitWithJavaScript());
                break;

            case Remotephantom:
                driver = new RemoteWebDriver(new Uri(ConfigurationManager.ConnectionStrings["PhantomServerUrl"].ConnectionString), DesiredCapabilities.PhantomJS());
                break;

            case Remoteunit:
                driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnit());
                break;

            case Iexplorer:
                driver = new InternetExplorerDriver();
                break;

            default:
                throw new Exception();
            }
            return(driver);
        }
Esempio n. 24
0
        private void openFirefoxBrowser()
        {
            FirefoxProfileManager binary = new FirefoxProfileManager();
            FirefoxProfile        prof   = binary.GetProfile("Selenium");
            FirefoxOptions        co     = new FirefoxOptions();

            co.Profile = prof;
            browser    = new FirefoxDriver(co);

            // отправляемся по ссылке
            browser.Navigate().GoToUrl("https://web.telegram.org");

            //https://web.telegram.org
        }
Esempio n. 25
0
        private void InitProfile()
        {
            FirefoxProfileManager profileManager = new FirefoxProfileManager();

            // Firefox profile name: default, WebDriver,WebLinked
            profile = profileManager.GetProfile("WebDriver");
            //profile = profileManager.GetProfile("WebLinked");

            profile.AcceptUntrustedCertificates = true;
            profile.EnableNativeEvents          = true;
            profile.SetPreference("browser.startup.homepage_override.mstone", "ignore");
            log.Info("Profile inited:");
            log.Info("  directory: {0}", profile.ProfileDirectory);
        }
Esempio n. 26
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                //连接端口
                FirefoxProfileManager profileManager = new FirefoxProfileManager();
                FirefoxProfile        profile        = profileManager.GetProfile("lang");
                profile.SetPreference("auto-reader-view.sdk.load.reason", "startup");
                var driver = new FirefoxDriver(profile);

                driver.Navigate().GoToUrl("http://*****:*****@id='container']"));
                //Screenshot screenShotFile = ((ITakesScreenshot)driver).GetScreenshot();

                //screenShotFile.SaveAsFile("test.gif", ScreenshotImageFormat.Gif);

                //设置窗体最大化
                //driver.Manage().Window.Maximize();
                //找到对象
                var imgelement = driver.FindElement(By.XPath("//div[@class='main_box']"));
                var location   = imgelement.Location;
                var size       = imgelement.Size;

                var savepath = @"d:\codingpy_1.png";
                driver.GetScreenshot().SaveAsFile(savepath, ScreenshotImageFormat.Png);//屏幕截图
                Image image  = System.Drawing.Image.FromFile(savepath);
                int   left   = location.X;
                int   top    = location.Y;
                int   right  = left + size.Width;
                int   bottom = top + size.Height;
                //截图
                Bitmap    bitmap     = new Bitmap(savepath);                         //原图
                Bitmap    destBitmap = new Bitmap(size.Width, size.Height);          //目标图
                Rectangle destRect   = new Rectangle(0, 0, size.Width, size.Height); //矩形容器
                Rectangle srcRect    = new Rectangle(left, top, size.Width, size.Height);
                Graphics  graphics   = Graphics.FromImage(destBitmap);
                graphics.DrawImage(bitmap, destRect, srcRect, GraphicsUnit.Pixel);
                destBitmap.Save("d:\\aa.png", System.Drawing.Imaging.ImageFormat.Png);
                graphics.Dispose();
            }

            catch (System.Net.Sockets.SocketException ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 27
0
        // public static object ConfigurationManager { get; private set; }

        private static FirefoxOptions GetFirefoxOptions()
        {
            FirefoxProfileManager manager = new FirefoxProfileManager();
            FirefoxOptions        options = new FirefoxOptions();

            {
                var            profileManager = new FirefoxProfileManager();
                FirefoxProfile profile        = profileManager.GetProfile("default");
                // IWebDriver driver = new FirefoxDriver(profile);
                // FirefoxProfile = manager.GetProfile("default"),

                options.AcceptInsecureCertificates = true;
            };

            return(options);
        }
Esempio n. 28
0
 private void GoToAccessibility_Course(object sender, EventArgs e)
 {
     if (chrome == null)
     {
         //Open the browser to be controlled
         var manager   = new FirefoxProfileManager();
         var ffProfile = manager.GetProfile("default");
         var fds       = FirefoxDriverService.CreateDefaultService(MainWindow.panelOptions.FirefoxDriverPath);
         fds.HideCommandPromptWindow = true;
         var options = new FirefoxOptions();
         options.Profile = ffProfile;
         chrome          = new FirefoxDriver(fds, options);
         wait            = new WebDriverWait(chrome, new TimeSpan(0, 0, 10));
     }
     chrome.Url = "https://byu.instructure.com/courses/1026";
 }
        /// <summary>
        /// Desc:Method is used to initializatied the driver
        /// </summary>
        /// <param name="data"></param>
        /// <param name="testCaseName"></param>
        /// <returns></returns>
        public DataRow DriverInitialization(Dictionary <string, string> data, string testCaseName)
        {
            DataRow dr = null;
            ExcelReaderUsingOleDb excelReader = new ExcelReaderUsingOleDb();

            dt = excelReader.ReadExcelData(EnumClasses.SheetNames.TestCases.ToString());
            if (dt.Rows.Count > 0)
            {
                datarow = dt.Select("testcaseid =" + data["testcaseid"]).FirstOrDefault();
                DataTable dt1 = excelReader.ReadExcelData(testCaseName);
                dr = dt1.Select("testcaseid =" + datarow["testcaseid"].ToString() + "AND id=" + data["id"].ToString()).FirstOrDefault();

                string BrowserName = dr["browsername"].ToString();
                string Url         = ConfigurationManager.AppSettings["Url"];
                string driverPath  = GetDriversPath();
                if (BrowserName == EnumClasses.BrowserName.ie.ToString())
                {
                    var options = new InternetExplorerOptions();
                    options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                    driver = new InternetExplorerDriver(options);
                    driver = new InternetExplorerDriver(driverPath);
                }
                else if (BrowserName == EnumClasses.BrowserName.firefox.ToString())
                {
                    FirefoxProfileManager Manager  = new FirefoxProfileManager();
                    FirefoxProfile        profile  = Manager.GetProfile("Default");
                    FirefoxDriverService  Services = FirefoxDriverService.CreateDefaultService(driverPath);
                    FirefoxOptions        option   = new FirefoxOptions();
                    option.Profile = profile;
                    driver         = new FirefoxDriver(Services, option, TimeSpan.FromSeconds(60));
                }
                else if (BrowserName == EnumClasses.BrowserName.chrome.ToString())
                {
                    driver = new ChromeDriver(driverPath);
                    ChromeOptions options = new ChromeOptions();
                    options.AddArguments("--start-maximized");
                }
                else
                {
                    driver = new ChromeDriver(driverPath);
                }
                driver.Navigate().GoToUrl(Url);
                System.Threading.Thread.Sleep(100);
                driver.Manage().Window.Maximize();
            }
            return(dr);
        }
        protected virtual DriverOptions CreateFirefoxDriverOptions()
        {
            try
            {
                var options                    = new FirefoxOptions();
                var profileManager             = new FirefoxProfileManager();
                var browserProfileSetting      = _configurationReader.GetConfigurationValue(Constants.Configuration.BrowserProfileKey);
                var enableDetailLoggingSetting = _configurationReader.GetConfigurationValue(Constants.Configuration.EnableDetailedLogging).ToLower();
                var headlessSetting            = _configurationReader.GetConfigurationValue(Constants.Configuration.HeadlessKey).ToLower();
                _loggingUtility.Info($"Browser Profile: {browserProfileSetting}, Detailed Logging: {enableDetailLoggingSetting}, Headless: {headlessSetting}");

                var profile = profileManager.GetProfile(string.IsNullOrWhiteSpace(browserProfileSetting) ? "default" : browserProfileSetting);
                if (profile != null)
                {
                    profile.AcceptUntrustedCertificates      = true;
                    profile.AssumeUntrustedCertificateIssuer = true;
                    options.Profile = profile;
                }

                options.AddArguments("--width-1920");
                options.AddArguments("--height-1080");

                if (string.Equals(enableDetailLoggingSetting, Infrastructure.Constants.Generic.TrueValue))
                {
                    options.LogLevel = FirefoxDriverLogLevel.Trace;
                }

                if (string.Equals(headlessSetting, Infrastructure.Constants.Generic.TrueValue))
                {
                    options.AddArguments("--headless");

                    /*options.AddArgument("disable-extensions");
                     * options.AddArgument("disable-gpu");
                     * options.AddArgument("disable-infobars");*/
                }

                return(options);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e);
                _loggingUtility.Error($"Exeception: {e.Message}, Inner Exception: {e.InnerException?.Message}");
                throw;
            }
        }