Allows the user to enumerate and access existing named Firefox profiles.
 private static IEnumerable<FirefoxProfile> GetProfilesInUse()
 {
     var mgr = new FirefoxProfileManager();
     return mgr.ExistingProfiles
         .Select(mgr.GetProfile)
         .Where(p => p.IsRunning());
 }
Example #2
0
 private static FirefoxProfile GetFirefoxOptions()
 {
     FirefoxProfile profile = new FirefoxProfile();
     FirefoxProfileManager manager = new FirefoxProfileManager();
     profile = manager.GetProfile("default");
     return profile;
 }
Example #3
0
        private static ExtensionConnection CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile)
        {
            FirefoxProfile profileToUse = profile;

            // TODO (JimEvans): Provide a "named profile" override.
            // string suggestedProfile = System.getProperty("webdriver.firefox.profile");
            string suggestedProfile = null;

            if (profileToUse == null && suggestedProfile != null)
            {
                profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile);
            }
            else if (profileToUse == null)
            {
                profileToUse = new FirefoxProfile();
                profileToUse.AddExtension(false);
            }
            else
            {
                profileToUse.AddExtension(false);
            }

            ExtensionConnection extension = ConnectTo(binary, profileToUse, "localhost");

            return(extension);
        }
Example #4
0
 public void ShouldBeAbleToStartANamedProfile()
 {
     FirefoxProfile profile = new FirefoxProfileManager().GetProfile("default");
     if (profile != null)
     {
         IWebDriver firefox = new FirefoxDriver(profile);
         firefox.Quit();
     }
     else
     {
         Assert.Ignore("Skipping test: No profile named \"default\" found.");
     }
 }
Example #5
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();
        }
Example #6
0
        public void ShouldBeAbleToStartANamedProfile()
        {
            FirefoxProfile profile = new FirefoxProfileManager().GetProfile("default");

            if (profile != null)
            {
                IWebDriver firefox = new FirefoxDriver(profile);
                firefox.Quit();
            }
            else
            {
                Assert.Ignore("Skipping test: No profile named \"default\" found.");
            }
        }
Example #7
0
        private static ICommandExecutor CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
        {
            FirefoxProfile firefoxProfile      = profile;
            string         environmentVariable = Environment.GetEnvironmentVariable("webdriver.firefox.profile");

            if (firefoxProfile == null && environmentVariable != null)
            {
                firefoxProfile = new FirefoxProfileManager().GetProfile(environmentVariable);
            }
            else if (firefoxProfile == null)
            {
                firefoxProfile = new FirefoxProfile();
            }
            return(new FirefoxDriverCommandExecutor(binary, firefoxProfile, "localhost", commandTimeout));
        }
        public IWebDriver Current()
        {
            //DesiredCapabilities chromeCapabilities = new DesiredCapabilities();
            Browser = ConfigurationManager.AppSettings["browser"];
            Testenvironment = ConfigurationManager.AppSettings["Environment"];
            Environment.SetEnvironmentVariable("Testenvironment", Testenvironment);

            EnvironmentConfiguration.CreateInstance(@"Framework\Environment.xml", Testenvironment);
            Url = EnvironmentConfiguration.Instance.GetEnvironmentVariable("URL");
            //Url1 = EnvironmentConfiguration.Instance.GetEnvironmentVariable("URL1");

            if (!FeatureContext.Current.ContainsKey("browser"))
            {
                switch (Browser)
                {
                    case "IE":
                        break;

                    case "FIREFOX":
                        var profileManager = new FirefoxProfileManager();
                        FirefoxProfile profile = profileManager.GetProfile("SeleniumProfile");
                        FeatureContext.Current["browser"] = new FirefoxDriver(profile);
                        ScenarioContext.Current["browser"] = FeatureContext.Current["browser"];
                        driver = (IWebDriver) ScenarioContext.Current["browser"];
                        driver.Manage().Window.Maximize();
                        driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 30));
                        break;

                    case "CHROME":
                        var options = new ChromeOptions();
                        options.AddArgument("--start-maximized");
                        driver = new ChromeDriver(options);
                        //FeatureContext.Current["browser"] = new ChromeDriver(options);
                        //ScenarioContext.Current["browser"] = FeatureContext.Current["browser"];
                        //driver = (IWebDriver)ScenarioContext.Current["browser"];
                        break;
                }
            }
            else
            {
                ScenarioContext.Current["browser"] = FeatureContext.Current["browser"];
                driver = (IWebDriver) ScenarioContext.Current["browser"];
            }
            return driver;
        }
Example #9
0
        private static ICommandExecutor CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
        {
            FirefoxProfile profileToUse = profile;

            string suggestedProfile = Environment.GetEnvironmentVariable("webdriver.firefox.profile");

            if (profileToUse == null && suggestedProfile != null)
            {
                profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile);
            }
            else if (profileToUse == null)
            {
                profileToUse = new FirefoxProfile();
            }

            FirefoxDriverCommandExecutor executor = new FirefoxDriverCommandExecutor(binary, profileToUse, "localhost", commandTimeout);

            return(executor);
        }
Example #10
0
        static void Main(string[] args)
        {
            FirefoxOptions option = new FirefoxOptions();
            ICapabilities cap = option.ToCapabilities();

            FirefoxProfileManager mangage = new FirefoxProfileManager();
            FirefoxProfile profile = mangage.GetProfile(mangage.ExistingProfiles[0]);

            IWebDriver driver = new FirefoxDriver(profile);

            driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(60));
            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
            driver.Manage().Window.Maximize();
            driver.Navigate().GoToUrl("https://www.baidu.com/");
            IWebElement input = driver.FindElement(By.Id("kw"));
            input.SendKeys("shinetech");
            IWebElement search = driver.FindElement(By.Id("su"));
            search.Click();
            IWebElement shinetech = driver.FindElement(By.XPath("//div[@id='1']/h3/a"));
            if(shinetech!=null)
            {
                if(shinetech.Text.Contains("盛安德"))
                {
                    Console.WriteLine("Find shinetech, test passed");
                }
                else
                {
                    Console.WriteLine("Cannot find Shinetech, test case failed");
                }
            }
            else
            {
                Console.WriteLine("Cannot find Shinetech, test case failed");
            }
            shinetech.Click();
            driver.Dispose();
        }
Example #11
0
        public void SetupTest()
        {
            FirefoxProfileManager prf = new FirefoxProfileManager();
            FirefoxProfile ffp = prf.GetProfile("selenium");

            //########################################################################
            //string folderName = @"C:\Projects\C#Worx\MellonBankLockbox"; // downloaded to C:\existingfolder as expected
            //Console.WriteLine("Saving to: " + folderName);
            //ffp.SetPreference("browser.download.dir", folderName);
            //ffp.SetPreference("browser.download.downloadDir", folderName);
            //ffp.SetPreference("browser.download.defaultFolder", folderName);

            //string folderName = Directory.GetCurrentDirectory(); // downloaded to GetCurrentDirectory as expected
            //string folderName = @"C:\nonexisting"; // downloaded to last used folder
            //string folderName = @"C:\existingfolder"; // downloaded to C:\existingfolder as expected
            //string folderName = @"C:\existingfolder\"; // won't work
            //string folderName = @"C:\"; // won't work, same as previous one

            //var profile = new FirefoxProfile { EnableNativeEvents = true };
            //profile.SetPreference("browser.download.folderList", 2);
            //profile.SetPreference("browser.download.manager.showWhenStarting", false);
            //profile.SetPreference("browser.download.dir", folderName);
            //profile.SetPreference("browser.download.downloadDir", folderName);
            //profile.SetPreference("browser.download.defaultFolder", folderName);
            //profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "application/pdf,image/jpeg,application/vnd.oasis.opendocument.text,application/vnd.oasis.opendocument.spreadsheet," +
            //                                                                            "application/vnd.oasis.opendocument.presentation,application/vnd.oasis.opendocument.graphics," +
            //                                                                            "application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet," +
            //                                                                            "application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation," +
            //                                                                           "application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.mozilla.xul+xml," +
            //                                                                            "application/vnd.google-earth.kml+xml");
            //########################################################################
            driver = new FirefoxDriver(ffp);

            baseURL = "https://connect.bnymellon.com/";
            verificationErrors = new StringBuilder();
        }
Example #12
0
        private static ExtensionConnection CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile)
        {
            FirefoxProfile profileToUse = profile;

            string suggestedProfile = Environment.GetEnvironmentVariable("webdriver.firefox.profile");

            if (profileToUse == null && suggestedProfile != null)
            {
                profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile);
            }
            else if (profileToUse == null)
            {
                profileToUse = new FirefoxProfile();
                profileToUse.AddExtension(false);
            }
            else
            {
                profileToUse.AddExtension(false);
            }

            ExtensionConnection extension = ConnectTo(binary, profileToUse, "localhost");

            return(extension);
        }
Example #13
0
        private static void Main(string[] args)
        {
            try
            {

            SetupTest:
            FirefoxProfileManager prf = new FirefoxProfileManager();
            Console.WriteLine("args[] length = {0}", args.Length);
            if (args.Length > 0)
            {
                batchDate = args[0];
            }
            Console.WriteLine("Date of Batches:" + batchDate);

            //########################################################################
            driver = new FirefoxDriver(); //ffp
            baseURL = "https://connect.bnymellon.com/";

            TheWebdrv2Test:
            driver.Navigate().GoToUrl(baseURL + "/ConnectLogin/login/LoginPage.jsp");
            sleep(0, "to load home page...");
            TimeSpan timeOut = new TimeSpan(0, 0, 0, 30);

            try
            {
                //if (MessageBox.Show("Can i login?", "Question", MessageBoxButtons.YesNo) == DialogResult.No) { driver.Quit(); Environment.Exit(1); }
                driver.FindElement(By.Id("userIDFLD")).Clear();
                driver.FindElement(By.Id("userIDFLD")).SendKeys("16622wdi");
                driver.FindElement(By.Id("btUserIdSubmit")).Click();
                sleep(1, "Username entered...");

                //string bankPWD = "";
                driver.FindElement(By.Id("PASSWORD")).Clear();
                driver.FindElement(By.Id("PASSWORD")).SendKeys("Bank2013-1");
                driver.FindElement(By.Id("btPasswordSubmit")).Click();
                sleep(4, "Password entered...");
            }
            catch (Exception e)
            {
                sleep(3, "could not find user name or password fields, exit code (1)...");

                driver.Quit();
                Environment.Exit(1);
            }
            finally
            {
                if (driver.Url != "https://connect.bnymellon.com/wps/myportal/connect/te")
                {
                    sleep(3, "then Exit due to wrong login or activation needed, exit code (2)...");
                    driver.Quit();
                    Environment.Exit(2);
                }
                else
                {
                    Console.WriteLine("Login Successfull...");
                }
            }

            /*########################################################*/
            sleep(1, "then go to daily deposits page & Open App");
            //############################ The App can be started with either one of these links ################################################################
            //https: //connect.bnymellon.com/wps/myportal/!ut/p/c5/04_SB8K8xLLM9MSSzPy8xBz9CP0os3gTQ0dnQ28vEwMLSz9zA08TT3c3Jw8jI39fM6B8pFm8e7BTgHmgkYeBaZg_UN7YPdDF3SvY0MDAgBjdcHl3Cz9DoLy3s5uRc5Chewgh3X4e-bmp-gW5oRHljoqKAM1B1Ac!/dl3/d3/L2dJQSEvUUt3QS9ZQnZ3LzZfNDFBQzFLSjQwODlONzBJNElHRkJIMjJPTTY!/
            //https: //connect.bnymellon.com/wps/myportal/!ut/p/c5/04_SB8K8xLLM9MSSzPy8xBz9CP0os3gTQ0dnQ28vEwN3Cz9DA08Tb2c3I-cgQwN_E6B8pFm8e7BTgHmgkYeBaZi_uYGnsXugi7tXsKGBgQEB3X4e-bmp-gW5EeUAt_6VWg!!/dl3/d3/L2dJQSEvUUt3QS9ZQnZ3LzZfNDFBQzFLSjQwODlONzBJNElHRkJIMjJPTTY!/
            //############################ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ################################################################
            driver.Navigate().GoToUrl(
                "https://connect.bnymellon.com/wps/myportal/!ut/p/c5/04_SB8K8xLLM9MSSzPy8xBz9CP0os3gTQ0dnQ28vEwN3Cz9DA08Tb2c3I-cgQwN_E6B8pFm8e7BTgHmgkYeBaZi_uYGnsXugi7tXsKGBgQEB3X4e-bmp-gW5EeUAt_6VWg!!/dl3/d3/L2dJQSEvUUt3QS9ZQnZ3LzZfNDFBQzFLSjQwODlONzBJNElHRkJIMjJPTTY!/");
            sleep(2, "then go to batchs list page");
            driver.Navigate().GoToUrl("https://mellon.olta.enternetbank.com/IPOnline/Scripts/dailydeposits.aspx");
            sleep(0, "then go to daily deposits");
            driver.Navigate().GoToUrl(
                "https://mellon.olta.enternetbank.com/IPOnline/Scripts/batchsummary.aspx?lckbx=ef1d0ad3-2194-4ff9-a954-96d2a600382d&date=" + batchDate);
            // /*########################################################*/
            int i = 0;
            string t;
            ReadOnlyCollection<IWebElement> mylinksList;

            do
            {
                //goto batchs list page
                driver.Manage().Timeouts().SetPageLoadTimeout(timeOut); // /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
                sleep(0, "then Start counting batchs... (i=" + i + ")");
                mylinksList = driver.FindElements(By.CssSelector("a[title=\"View Batch Detail\"]"));
                    //TagName("a") will give you list of all the links in the page
                var batchCount = mylinksList.Count;
                if (batchCount < 1)
                {
                    sleep(3, "then log out due to EMPTY BATCH, exit code (3)...");
                    //LogOut();
                    driver.Quit();
                    Environment.Exit(3);
                    //break;
                }
                else
                {
                    //sleep(9,                          "Links List populated with " + mylinksList.Count + " items ==> (" + mylinksList.Count/2 +                          " Batches)");
                    Console.WriteLine("\t<< i={0} >> batch {1}/{2}", i, i/2, mylinksList.Count/2);
                    Console.Write("\t");
                    foreach (IWebElement t1 in mylinksList)
                    {
                        Console.Write(t1.Text + "*");
                    } //Listing all links names to view

                    if (i < batchCount)
                    {
                        t = mylinksList[i].Text;
                        // Get Internal Batch Code
                        var internalBatchCode = "";
                        //int xx; bool x = Int32.TryParse(t, out xx); xx += 1; Console.WriteLine(xx);
                        int n = Convert.ToInt32(t);
                        if (n >= 101 & n <= 199) //101-199	Retail (machine read from OCR scan line)	Check	RCT	Lockbox Batch //13-11-21-RCT01
                            { internalBatchCode = "RCT"; }
                            else if (n >= 201 & n <= 450) //201-450	Wholesale (keyed by Mellon from scan line or from text)	Check	WCT	Lockbox Batch
                                { internalBatchCode = "WCT"; }
                                else if (n >= 451 & n <= 499) //451-499	Check data only (MICR Automated)	Check	MCT	Lockbox Batch
                                    { internalBatchCode = "MCT"; }
                                        //else if (n >= 501 & n <= 560) //501-560	Credit Cards (keyed by Mellon from DART OCR scan line)	Credit Cards	WCC	Lockbox Batch
                                        //{internalBatchCode = "WCC";}
                                        //    else if (n >= 651 & n <= 660) //651-660	Credit Cards (keyed by Mellon from text)	Credit Cards	WCC
                                        //    {internalBatchCode = "WCC";}
                                        //        else if (n >= 901 & n <= 960) //901-960	Credit Cards (keyed by Mellon from DAC OCR scan line)	Credit Cards	WCC	Lockbox Batch
                                        //        {internalBatchCode = "WCC";}
                                                      else //(All Other Undefined Ranges)
                                                      { internalBatchCode = "XXX"; }
                        if (internalBatchCode != "XXX")
                        {
                        //click on batch name
                        Console.WriteLine("\n=======> clicking on item: {0}", t);
                        Console.WriteLine("\tDate:={0}=", batchDate);
                        sleep(0, " click to download ==> " + t);
                        var batchURL =
                            "https://mellon.olta.enternetbank.com/IPOnline/Scripts/viewallimages.aspx?bank=1&lbx=10189&batch=" + t + "&date=" + batchDate;
                          //https: //mellon.olta.enternetbank.com/IPOnline/Scripts/viewallimages.aspx?bank=1&lbx=10189&batch=   103   &date=    11/13/2013
                        driver.Navigate().GoToUrl(batchURL);
                        //driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
                        //driver.Manage().Timeouts().SetPageLoadTimeout(timeOut); // /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
                        sleep(1, "Wait for Processing Request");
                            do
                            {
                                var ps = driver.PageSource;
                                var idx = ps.IndexOf("Processing Request");
                                //Console.Write("<@>");
                                Console.WriteLine("<@>{0}",driver.Url);
                                Thread.Sleep(1000);
                                if (idx < 0)
                                {break;}
                            } while (true);

                            //sleep(30, "to process download then Go back"); // numTries
                            while (driver.Url.IndexOf("numTries") >= 0)
                            {
                                Console.Write("<<numTries>>");
                                Thread.Sleep(1000);
                                var pdf1 = driver.FindElements(By.LinkText("Batch " + t + ".pdf"));
                                var pdf2 = driver.Url.IndexOf(".pdf");
                                if (pdf1.Count > 0 || pdf2 > 0)
                                {
                                    Console.WriteLine("<<Batch {0}.pdf>>",t);
                                    Console.WriteLine("PDF in Page @ point:{0}",driver.PageSource.IndexOf(".pdf"));
                                    Console.WriteLine("PDF in Page @ U R L:{0}", driver.Url.IndexOf(".pdf"));
                                    break;
                                }
                            }
                        sleep(1, "to process download then Go back");
                        var back = 1;
                        var myPDFlink = driver.FindElements(By.LinkText("Batch " + t + ".pdf")); //By.TagName("a"));  // will give you list of all the links in the page
                        if (myPDFlink.Count > 0)
                        {
                            myPDFlink[0].Click();
                            sleep(0, "found (.pdf) link");
                            back += 1;
                        }
                        //##################### get current URL #########################
                        var currentURL = driver.Url;
                        Console.WriteLine("\nURL: {0}\n", currentURL);
                        //############### Download file in Directory & Create Directory for Downloads ####################
                        var fyscalYear = 0;
                        if (DateTime.ParseExact(batchDate, "MM/dd/yyyy", null).Month >= 7)
                        {
                            fyscalYear = DateTime.ParseExact(batchDate, "MM/dd/yyyy", null).Year + 1;
                        }
                        else
                        {
                            fyscalYear = DateTime.ParseExact(batchDate, "MM/dd/yyyy", null).Year;
                        }
                        Console.WriteLine("Fyscal Year is: {0}", fyscalYear);

                        var yy = DateTime.ParseExact(batchDate, "MM/dd/yyyy", null).ToString("yy");
                        var mm = DateTime.ParseExact(batchDate, "MM/dd/yyyy", null).ToString("MM");
                        var dd = DateTime.ParseExact(batchDate, "MM/dd/yyyy", null).ToString("dd");
                        var localPath = @"S:\Gift and Records Administration\Mellon Imaging";
                            //"\\dev-share.m.storage.umich.edu\dev-share\Apps\GF_DEV\Gift and Records Administration\Mellon Imaging";
                            //"C:\Users\hgothamy\Downloads\Gift and Records Administration\Mellon Imaging\"; // +@"\t";
                        Console.WriteLine("\nLocal Path is: {0}\n", localPath);

                        DirectoryInfo directoryInfo = Directory.CreateDirectory(localPath + "\\" + fyscalYear + "\\" + yy + mm + "\\");

                      var fileNamePath = directoryInfo.FullName + "\\" + yy + "-" + mm + "-" + dd + "-" + internalBatchCode + t.Substring(1, t.Length - 1) + ".pdf";

                        using (WebClient Client = new WebClient())
                        {
                            Client.DownloadFile(currentURL, fileNamePath);
                        }
                        Console.WriteLine("\nDownloaded: {0}\nFrom URL:{1}", fileNamePath,currentURL);
                        for (int b = 1; b <= back; b++)
                        {
                            driver.Navigate().Back(); //back to batchs list page
                            sleep(0, "Going Back: " + b + "/" + back);
                        }
                    }
                        i += 2;
                    }
                    else
                    {
                        sleep(60, "\n\n\t================== DONE ====================" +
                                    "\n\tGiving 60 seconds for downloads to complete" +
                                    "\n\t============================================\n");
                        break;
                    }
                }
            } while (true);
            /*########################################################*/
                Console.WriteLine("<><><><><><><><><><><><><><><><><><><><><>><><><><><>><><><><><><><><><><><><><><><><>");
                //Console.ReadLine();
            LogOut();
            /*########################################################*/
            //}
            sleep(3, "completed successfuly, exit code (0)... :)");
            Environment.Exit(0);
            }
            catch (Exception e)
            {

                sleep(3, "Unknown error or connection lost, exit code (666)...");
                Console.WriteLine("\n"+e+"\n");
                driver.Quit(); // close all associated windows
                Environment.Exit(666);
            }
        }
Example #14
0
        private static ICommandExecutor CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
        {
            FirefoxProfile profileToUse = profile;

            string suggestedProfile = Environment.GetEnvironmentVariable("webdriver.firefox.profile");
            if (profileToUse == null && suggestedProfile != null)
            {
                profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile);
            }
            else if (profileToUse == null)
            {
                profileToUse = new FirefoxProfile();
            }

            FirefoxDriverCommandExecutor executor = new FirefoxDriverCommandExecutor(binary, profileToUse, "localhost", commandTimeout);
            return executor;
        }
 public void SetUp()
 {
     manager = new FirefoxProfileManager();
 }
        public FirefoxProfileManager()
        {
            string applicationDataDirectory = FirefoxProfileManager.GetApplicationDataDirectory();

            this.ReadProfiles(applicationDataDirectory);
        }
Example #17
0
        private static ExtensionConnection CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile)
        {
            FirefoxProfile profileToUse = profile;

            string suggestedProfile = Environment.GetEnvironmentVariable("webdriver.firefox.profile");
            if (profileToUse == null && suggestedProfile != null)
            {
                profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile);
            }
            else if (profileToUse == null)
            {
                profileToUse = new FirefoxProfile();
                profileToUse.AddExtension(false);
            }
            else
            {
                profileToUse.AddExtension(false);
            }

            ExtensionConnection extension = ConnectTo(binary, profileToUse, "localhost");
            return extension;
        }
 private static FirefoxProfile GetFirefoxptions()
 {
     FirefoxProfile profile = new FirefoxProfile();
     FirefoxProfileManager manager = new FirefoxProfileManager();
     return profile;
 }
Example #19
0
        private static ExtensionConnection CreateExtensionConnection(FirefoxBinary binary, FirefoxProfile profile)
        {
            FirefoxProfile profileToUse = profile;

            // TODO (JimEvans): Provide a "named profile" override.
            // string suggestedProfile = System.getProperty("webdriver.firefox.profile");
            string suggestedProfile = null;
            if (profileToUse == null && suggestedProfile != null)
            {
                profileToUse = new FirefoxProfileManager().GetProfile(suggestedProfile);
            }
            else if (profileToUse == null)
            {
                profileToUse = new FirefoxProfile();
                profileToUse.AddExtension(false);
            }
            else
            {
                profileToUse.AddExtension(false);
            }

            ExtensionConnection extension = ConnectTo(binary, profileToUse, "localhost");
            return extension;
        }
 public void SetUp()
 {
     manager = new FirefoxProfileManager();
 }
Example #21
0
        public void initialise(bool browser=true)
        {
            if (browser)
            {
                FirefoxProfileManager pm = new FirefoxProfileManager();
                FirefoxProfile ffp = pm.GetProfile(Global.FF_PROFILE);
                FirefoxOptions fo = new FirefoxOptions();
                fo.SetLoggingPreference(LogType.Driver, LogLevel.Off); //todo allow toggling this
                fo.SetLoggingPreference(LogType.Client, LogLevel.Off);
                
                mainBrowser = new FirefoxDriver(ffp);
            
                mainBrowser.Manage().Window.Maximize(); //prevent unintenttionally hiding elements in some versions of FF
                
                gBrowserInstance = mainBrowser;
                DesiredCapabilities d = new DesiredCapabilities();
            }

            analyticModule = new AnalyticModule(this, mainBrowser);
            randomModule = new RandomModule(this, mainBrowser);
            biasedModule = new BiasedModule(this, mainBrowser);
            compareModule = new ComparativeModule(this, mainBrowser);

        }