static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            int idInicio = 30000;
            int idFinal = 22000;
            int contador = 1;
            String url = "";

            driver.Navigate().GoToUrl(url + idInicio);
            driver.Manage().Window.Maximize();
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"e:\AllStudents.csv", true))
            {

                while (idInicio > idFinal)
                {
                    driver.Navigate().GoToUrl(url + idInicio);
                    IWebElement nome = driver.FindElement(By.Id("txtNome"));
                    IWebElement email = driver.FindElement(By.Id("txtmail_maior"));
                    if (email.GetAttribute("value").ToString() != "")
                    {
                        Console.WriteLine(contador + " - " + idInicio.ToString() + " - " + nome.GetAttribute("value").ToString() + " - " + email.GetAttribute("value").ToString());
                        file.WriteLine(contador + ";" + idInicio.ToString() + ";" + email.GetAttribute("value").ToString() +";"+ nome.GetAttribute("value").ToString());

                        contador++;
                    }
                    idInicio--;
                }
            }
        }
        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();
            const int idInicio = 0;
            const int idFim = 1000;

            int id = idInicio;
            String url = "http://fcv.matheusacademico.com.br/Aluno/frmAlunoAlteracao.asp?id=";

            driver.Navigate().GoToUrl(url + id);
            driver.Manage().Window.Maximize();

            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\AllStudents1.txt", true))
            {
                while (id < idFim)
                {
                    driver.Navigate().GoToUrl(url + id);
                    IWebElement nome = driver.FindElement(By.Id("txtNome"));
                    IWebElement email = driver.FindElement(By.Id("txtmail_maior"));

                    if (nome.GetAttribute("value").ToString() != "")
                        file.WriteLine(id.ToString() + " - " + nome.GetAttribute("value").ToString() + " - " + email.GetAttribute("value").ToString());
                    id++;
                }
            }
        }
        public void SingUp_TestUser_FindNameInHelloString()
        {
            firefox = new FirefoxDriver();
            firefox.Navigate().GoToUrl("http://*****:*****@mail.com");
            firefox.FindElement(By.Id("inputPassword")).SendKeys("123");
            firefox.FindElement(By.Id("submit")).Click();
            firefox.FindElement(By.Id("login")).Click();

            //log in page
            firefox.FindElement(By.Id("inputEmail")).SendKeys("*****@*****.**");
            firefox.FindElement(By.Id("inputPassword")).SendKeys("123");
            firefox.FindElement(By.Id("login")).Click();

            firefox.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
            string helloString = firefox.FindElement(By.Id("helloString")).Text;
            string result = "Hello, testFirstName testLastName";

            //delete test user
            firefox.Navigate().GoToUrl("http://localhost:57336/User/UsersProfile");
            firefox.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
            firefox.FindElement(By.Id("deleteProfile")).Click();

            Assert.IsTrue(result == helloString);
        }
Exemple #4
0
        public void injectionAttack()
        {
            FirefoxDriver ffox = new FirefoxDriver();

            ffox.Navigate().GoToUrl("localhost:58374/safeinsert.aspx");
            ffox.FindElementById("sname").SendKeys("Bart Simpson',4);delete from students where name='Bart Simpson';update students set gpa = 4;--");
            ffox.FindElementById("sgpa").SendKeys("2.0");
            ffox.FindElementById("InsertStudent").Click();

            DataTable results = ServerConn.MyQuery("SELECT * FROM students");

            bool InjectionFailed = false;

            foreach (DataRow d in results.Rows)
            {
                if (d.ItemArray[1].Equals("Bart Simpson',4);delete from students where name='Bart Simpson';update students set gpa = 4;--"))
                    InjectionFailed = true;
            }

            Assert.IsTrue(InjectionFailed, "Error: Safe insert did not prevent the SQL injection");

            ffox.Navigate().GoToUrl("localhost:58374/unsafeinsert.aspx");
            ffox.FindElementById("sname").SendKeys("Bart Simpson',4);delete from students where name='Bart Simpson';update students set gpa = 4;--");
            ffox.FindElementById("sgpa").SendKeys("4.0");
            ffox.FindElementById("InsertStudent").Click();

            results = ServerConn.MyQuery("SELECT * FROM students");
            foreach (DataRow d in results.Rows)
            {
                Assert.AreEqual((float) 4, (float) d.ItemArray[2], "Error: Student {0} does not have a GPA of 4", d.ItemArray[1].ToString());
                Assert.AreNotEqual("Bart Simpson", d.ItemArray[1].ToString(), "Error you didn't cover your tracks!");
            }
        }
Exemple #5
0
        public void XSSAttack()
        {
            FirefoxDriver ffox = new FirefoxDriver();

            ffox.Navigate().GoToUrl("localhost:58374/safeinsert.aspx");
            ffox.FindElementById("sname").SendKeys("23',3);<script>document.body.setAttribute('style','background-image: url(\"http://vignette1.wikia.nocookie.net/simpsons/images/7/7b/Eat_My_Shorts.jpg/revision/latest?cb=20100606181712\");');</script>--");
            ffox.FindElementById("sgpa").SendKeys("2.0");
            ffox.FindElementById("InsertStudent").Click();

            ffox.Navigate().GoToUrl("localhost:58374/unsafeshowall.aspx");
            Assert.IsTrue(ffox.FindElementByTagName("body").GetAttribute("style").Contains("url(\"http://vignette1.wikia.nocookie.net/simpsons/images/7/7b/Eat_My_Shorts.jpg/revision/latest?cb=20100606181712"),"XSS Script failed to change background image");

            ffox.Navigate().GoToUrl("localhost:58374/safeshowall.aspx");
            Assert.IsFalse(ffox.FindElementByTagName("body").GetAttribute("style").Contains("url(\"http://vignette1.wikia.nocookie.net/simpsons/images/7/7b/Eat_My_Shorts.jpg/revision/latest?cb=20100606181712"),"SafeShowAll page failed in preventing background image from being injected");
        }
        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("http://cnn.com");

            while(true)
            {
                driver.Navigate().Refresh();

                scanMainHeadline(driver.FindElement(By.ClassName("banner-text")).Text);

                System.Threading.Thread.Sleep(10000);
            }
        }
 static void Main(string[] args)
 {
     try
         {   // Instantiating variables
             string[] theURLs = new string[3];
             string[] theCriteria = new string[3];
             int wi, milsec=2500;
             // Instantiating classes
             IWebDriver wbDriver = new FirefoxDriver();
             TheWebURLs webI=new TheWebURLs();
             LoggingStuff logMe = new LoggingStuff();
             wbDriver.Manage().Window.Maximize();
             // Setting values for variables
             theURLs=webI.getTheURLs();
             theCriteria=webI.getSearchCiteria();
             string logPath = logMe.createLogName().ToString();
             /**********************************************/
             // Run Test
             logMe.writeFile("Selenium Test Log", false, logPath);
             for(wi = 0; wi < 3; wi++)
             {   // Opens the various web pages
                 Console.WriteLine(theURLs[wi] + ", " + theCriteria[wi]);
                 logMe.writeFile(theURLs[wi] + ", " + theCriteria[wi], true, logPath);
                 wbDriver.Navigate().GoToUrl(theURLs[wi]);
                 Thread.Sleep(milsec*2);
             }
             wbDriver.Quit();
         }
     catch (IOException e3)
     {
         Console.WriteLine("Failed during Main",e3.Message);
     }
 }
Exemple #8
0
        /// <summary>
        /// Test all links on the Krossover home page
        /// </summary>
        public void testHomePage(FirefoxDriver driver)
        {
            string homePage = "http://www.krossover.com/";
            driver.Navigate().GoToUrl(homePage);
            Thread.Sleep(1000);

            //find all links on the page
            IList<IWebElement> links = driver.FindElementsByTagName("a");

            //loop through all of the links on the page
            foreach (IWebElement link in links)
            {
                try
                {
                    //check if any of the links return a 404
                    link.SendKeys(Keys.Control + Keys.Enter);
                    driver.SwitchTo().Window(driver.WindowHandles.Last());

                    driver.FindElementByXPath("//div[contains(@class, '404')]");
                    log(link.GetAttribute("href") + " is broken.  Returned 404");

                    driver.SwitchTo().Window(driver.WindowHandles.First());
                }
                catch
                {
                    //continue to the next link
                    continue;
                }

            }
            driver.Quit(); //kill the driver
        }
        // GET: RunSystemAdministrator
        public ActionResult RunSalesExecutive()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://localhost:4601/");
            var emp = _employeeService
                             .Queryable()
                             .Where(x => x.DepartmentRoleId == 10)
                             .FirstOrDefault ();
            emp.EmployeeLogin = _employeeLoginService
                                .Queryable()
                                .Where(x => x.EmployeeId == emp.EmployeeId)
                                .FirstOrDefault();
            IWebElement UserName = driver.FindElement(By.Name("UserName"));
            IWebElement Password = driver.FindElement(By.Name("Password"));
            var loginButton = driver.FindElement(By.XPath("/html/body/div/div/div/section/form/button"));

            UserName.SendKeys(emp.EmployeeLogin.UserName);
            Password.SendKeys(emp.EmployeeLogin.Password);
            loginButton.Click();

            Timer timer = new Timer(1000);
            timer.Start();

            timer.Stop();
            return View();
        }
        public void Add_Tweet_FindNewTweetInNewsfeed()
        {
            firefox = new FirefoxDriver();
            firefox.Navigate().GoToUrl("http://*****:*****@mail.com");
            //firefox.FindElement(By.Id("inputPassword")).SendKeys("123");
            //firefox.FindElement(By.Id("submit")).Click();
            //firefox.FindElement(By.Id("login")).Click();

            //log in page
            firefox.FindElement(By.Id("inputEmail")).SendKeys("*****@*****.**");
            firefox.FindElement(By.Id("inputPassword")).SendKeys("123");
            firefox.FindElement(By.Id("login")).Click();

            firefox.FindElement(By.Name("Body")).Click();
            firefox.FindElement(By.Name("Body")).SendKeys("test Tweet");

            firefox.FindElement(By.Id("tweetbutton")).Click();
            firefox.FindElement(By.Id("home")).Click();

            string tweetMessage = firefox.FindElement(By.TagName("h5")).Text;

            Assert.IsTrue(tweetMessage == "test Tweet");
        }
        public List<FootballItem> Parse() {
            List<FootballItem> res = new List<FootballItem>();

            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("https://www.marathonbet.com/su/popular/Football/?menu=true#");
            ReadOnlyCollection<IWebElement> main = driver.FindElements(By.ClassName("sport-category-container"));
            Debug.Assert(main.Count==1);
            ReadOnlyCollection<IWebElement> containers = main[0].FindElements(By.ClassName("category-container"));
            foreach (IWebElement container in containers) {
                ReadOnlyCollection<IWebElement> tables = container.FindElements(By.ClassName("foot-market"));
                Debug.Assert(tables.Count==1);
                ReadOnlyCollection<IWebElement> tbodys = tables[0].FindElements(By.XPath(".//tbody[@data-event-name]"));
                ParseTBody(tbodys, res);
            }

            /*
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); });
            */
            driver.Close();
            driver.Quit();

            return res;
        }
        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("http://www.integrationqa.com/");

            driver.Manage().Window.Maximize();

            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
            IWebElement menu = driver.FindElement(By.Id("hs_menu_wrapper_module_13970568219884"));
            Actions builder = new Actions(driver);
            builder.MoveToElement(menu).Build().Perform();

            IList<IWebElement> menuItemsList = menu.FindElements(By.ClassName("hs-menu-item"));

            String[] menuItems = new String[menuItemsList.Count];
            int i = 0;
            foreach (IWebElement menuItem in menuItemsList)
            {
                menuItems[i++] = menuItem.Text;
            }

            //Arrange all the list items in alphabetical order
            IEnumerable<String> orderedMenuList = menuItems.OrderBy(lv_menu => lv_menu).ToList();

            //Display the ordered list
            foreach (var menuItem in orderedMenuList)
            {
                if (menuItem.Length > 0)
                    Console.WriteLine(menuItem);
            }
            Console.ReadKey();
        }
        public void Attack1_Protected()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://localhost/LU.ENGI3675.Project04/StudentInput.aspx");

            IWebElement query = driver.FindElement(By.Name("fullName"));

            query.SendKeys("a','2.1'); update students * set gpa = 4.0; --");
            query = driver.FindElement(By.Name("GPA"));
            query.SendKeys("3");
            query = driver.FindElement(By.Name("button"));
            query.Click();
            System.Threading.Thread.Sleep(5000);

            List<LU.ENGI3675.Proj04.App_Code.Students> students =
                LU.ENGI3675.Proj04.App_Code.DatabaseAccess.Read();
            bool allfour = true;
            foreach (LU.ENGI3675.Proj04.App_Code.Students temp in students)
            {
                if (temp.GPA < 4.0) allfour = false;
                Debug.Write((string)temp.Name);
                Debug.Write(" ");
                Debug.WriteLine((double)temp.GPA);
            }
            Assert.IsFalse(allfour);    //if they aren't all 4.0 gpa, then protected against SQL injection
            driver.Quit();
        }
Exemple #14
0
 public void Test3()
 {
     var driver = new FirefoxDriver();
     driver.Navigate().GoToUrl("http://www.baidu.com");
     //driver.FindElement(By.LinkText("登录")).Click();
     driver.FindElementById("lb").Click();
 }
Exemple #15
0
        private static void DriverTest()
        {
            var driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("http://www.google.com/");

            // Find the text input element by its name
            var query = driver.FindElement(By.Name("q"));

            // Enter something to search for
            query.SendKeys("Cheese");

            // Now submit the form. WebDriver will find the form for us from the element
            query.Submit();

            // Google's search is rendered dynamically with JavaScript.
            // Wait for the page to load, timeout after 10 seconds
            var wait = new WebDriverWait(driver, System.TimeSpan.FromSeconds(10));
            wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); });

            // Should see: "Cheese - Google Search"
            System.Console.WriteLine("Page title is: " + driver.Title);

            //Close the browser
            driver.Quit();
        }
 public void TearUp()
 {
     FirefoxProfile profile = new FirefoxProfile();
     profile.SetPreference("dom.forms.number", false);
     ff = new FirefoxDriver(profile);
     ff.Navigate().GoToUrl(SITE_PATH);
 }
Exemple #17
0
        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl(@"http://www.weibo.com");

            WebDriverWait waitPageOpen = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
            IWebElement inpt_username = waitPageOpen.Until<IWebElement>((d) => { return d.FindElement(By.Name("username")); });
            waitPageOpen.Until((d) => { return inpt_username.Displayed; });
            inpt_username.SendKeys(@"*****@*****.**");

            IWebElement inpt_pwd = driver.FindElement(By.Name("password"));
            inpt_pwd.SendKeys(@"kodakpdc2000");

            IWebElement btn_login = driver.FindElement(By.ClassName("W_btn_g"));
            btn_login.Click();

            waitPageOpen.Until((d)=>{return d.Title.StartsWith("我的首页");});

            //IList<IWebElement> personInfos = driver.FindElements(By.ClassName("user_atten"));
            //if (personInfos.Count == 1)
            //{ personInfos[0].FindElement(By.PartialLinkText("粉丝")).Click(); }

            IWebElement temp = driver.FindElement(By.PartialLinkText("粉丝"));
            temp.Click();

            Console.Read();
        }
Exemple #18
0
 public void PostToBlog()
 {
     IWebDriver browser = new FirefoxDriver();
     browser.Navigate().GoToUrl("http://tumblr.com/login");
     IWebElement email = browser.FindElement(By.Id("signup_determine_email"));
     email.SendKeys("*****@*****.**");
     IWebElement verifyButton = browser.FindElement(By.Id("signup_forms_submit"));
     verifyButton.Click();
     browser.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
     IWebElement password = browser.FindElement(By.Id("signup_password"));
     password.SendKeys("******");
     IWebElement loginButton = browser.FindElement(By.Id("signup_forms_submit"));
     loginButton.Click();
     IWebElement textIcon = browser.FindElement(By.ClassName("icon_post_text"));
     textIcon.Click();
     IWebElement postTitle = browser.FindElement(By.ClassName("editor-plaintext"));
     postTitle.SendKeys("c# selenium");
     IWebElement postBody = browser.FindElement(By.ClassName("editor-richtext"));
     postBody.SendKeys("this is a c# with selenium test");
     IWebElement createPost = browser.FindElement(By.ClassName("create_post_button"));
     createPost.Click();
     //TearDown
     IWebElement postSettings = browser.FindElement(By.ClassName("post_control_menu"));
     postSettings.Click();
     IWebElement postDelete = browser.FindElement(By.ClassName("delete"));
     postDelete.Click();
     IWebElement okButton = browser.FindElement(By.ClassName("btn_1"));
     okButton.Click();
     IWebElement accountButton = browser.FindElement(By.ClassName("icon_user_settings"));
     browser.Close();
 }
        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl("http://www.seleniummaster.com/");

            driver.Manage().Window.Maximize();

            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
            IWebElement menu = driver.FindElement(By.Id("menubar"));
            Actions builder = new Actions(driver);
            builder.MoveToElement(menu).Build().Perform();

            IList<IWebElement> menuItemsList = menu.FindElements(By.Id("menu"));
            char[] delim = { '\r', '\n' };
            String[] menuList = menuItemsList[0].Text.Split(delim);

            //Query to orderby all the list items
            IEnumerable<string> orderedMenuList = menuList.OrderBy(lv_menu => lv_menu).ToList();

            //Display the ordered list
            foreach (string menuItem in orderedMenuList)
            {
                if (menuItem.Length > 0)
                    Console.WriteLine(menuItem);
            }
            Console.ReadKey();
        }
        public void Attack2_NonProtected()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://localhost/LU.ENGI3675.Project04/StudentInputUNSAFE.aspx");

            IWebElement query = driver.FindElement(By.Name("fullNameUS"));

            query.SendKeys("a','2.1'); update students * set gpa = 4.0; --");
            query = driver.FindElement(By.Name("GPAUS"));
            query.SendKeys("0");
            query = driver.FindElement(By.Name("button"));
            query.Click();
            System.Threading.Thread.Sleep(1000);

            List<LU.ENGI3675.Proj04.App_Code.Students> students =
                LU.ENGI3675.Proj04.App_Code.DatabaseAccess.Read();

            foreach (LU.ENGI3675.Proj04.App_Code.Students temp in students)
            {
                Assert.IsTrue((double)temp.GPA == 4);   //if any of them aren't 4.0, injection failed
                Debug.Write((string)temp.Name);
                Debug.Write(" ");
                Debug.WriteLine((double)temp.GPA);
            }
            driver.Quit();
        }
        public static bool LoginToSBM(string siteToTest, string sbmUserName, string sbmUserPass)
        {
            ///We will open that URL and will be performing test over it
            ///string siteToTest = "http://stl-alms-tst4/workcenter/tmtrack.dll?shell=swc";

            ///SBM credentials
           /// string sbmUserName = "******";
           /// string sbmUserPass = "";

            /// Open the site and wait 5 second while the site is loaded
            IWebDriver drv = new FirefoxDriver();
            ///drv.Navigate().GoToUrl("http://stl-qa-oalmt1/workcenter/tmtrack.dll?shell=swc");
            drv.Navigate().GoToUrl(siteToTest);
            System.Threading.Thread.Sleep(5000);


            ///find login form Username field and send sbmUserName variable content (string)
            IWebElement sbmLoginUName = drv.FindElement(By.Id("authUID"));
            sbmLoginUName.Clear();
            sbmLoginUName.SendKeys(sbmUserName);

            IWebElement sbmLoginUPass = drv.FindElement(By.Id("authPWD"));
            sbmLoginUPass.Clear();
            sbmLoginUPass.SendKeys(sbmUserPass);

            IWebElement sbmLoginBtn = drv.FindElement(By.Id("logonButton"));
            sbmLoginBtn.Click();

            IWebElement foh = drv.FindElement(By.CssSelector("div.cd-more-info:nth-child(1) > p:nth-child(2) > a:nth-child(3)"));
            Assert.AreEqual("Full online help",foh,true);

            return true;
        }
        /// <summary>
        /// Test form submission on Krossover basketball page
        /// </summary>
        public void testBasketballPage(FirefoxDriver driver)
        {
            //variables to enter in form
            string page = "http://www.krossover.com/basketball/";
            string name = "Jóhn Dóe"; //international character testing
            string teamName = "Test Team";
            string city = "New York";
            string state = "NY";
            string sport = "Football";
            string gender = "Male";
            string email = "*****@*****.**";
            string phone = "123-456-789";
            string day = "Friday";

            //fill out all the fields
            driver.Navigate().GoToUrl(page);
            driver.FindElementByName("Field1").SendKeys(name);
            driver.FindElementByName("Field2").SendKeys(teamName);
            driver.FindElementByName("Field3").SendKeys(city);
            driver.FindElementByName("Field4").SendKeys(state);
            driver.FindElementByName("Field6").FindElement(By.XPath(".//option[contains(text(),'" + sport + "')]")).Click();
            driver.FindElementByName("Field7").FindElement(By.XPath(".//option[contains(text(),'" + gender + "')]")).Click();
            driver.FindElementByName("Field9").SendKeys(email);
            driver.FindElementByName("Field11").SendKeys(phone);
            driver.FindElementByName("Field14").FindElement(By.XPath(".//option[contains(text(),'" + day + "')]")).Click();

            driver.FindElementByName("saveForm").Click(); //submit the form

            /*verify the form submission was actually generated by querying the db
             * if so, test passes
             * else, test fails
            */
            driver.Quit();
        }
Exemple #23
0
        public void CreateExamSchemaTest()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://dev.chd.miraclestudios.us/probo-php/admin/apps/backend/site/login");
            driver.FindElement(By.Id("UserLoginForm_username")).Clear();
            driver.FindElement(By.Id("UserLoginForm_username")).SendKeys("owner");
            driver.FindElement(By.Id("UserLoginForm_password")).Clear();
            driver.FindElement(By.Id("UserLoginForm_password")).SendKeys("ZFmS!H3*wJ2~^S_zx");
            driver.FindElement(By.Id("login-content-button")).Click();

            System.Threading.Thread.Sleep(2000);

            driver.FindElement(By.LinkText("Manage Examination")).Click();
            driver.FindElement(By.LinkText("Manage Exam Scheme")).Click();
            System.Threading.Thread.Sleep(2000);
            driver.FindElement(By.LinkText("Create Exam Scheme")).Click();
            System.Threading.Thread.Sleep(5000);
            Random rnd = new Random();

            new SelectElement(driver.FindElement(By.Id("PrbExamScheme_exam_category_id"))).SelectByText("Food Safety");

            new SelectElement(driver.FindElement(By.Id("levelid"))).SelectByText("Project Manager3610");
            driver.FindElement(By.Id("PrbExamScheme_scheme_name")).Clear();
            driver.FindElement(By.Id("PrbExamScheme_scheme_name")).SendKeys("ISO softengineering" + rnd.Next(1, 1000));
            driver.FindElement(By.Name("yt0")).Click();

            string URL = driver.Url;
            Assert.AreNotEqual("http://dev.chd.miraclestudios.us/probo-php/admin/apps/backend/probo/competencyDomain/view/id/", URL.Substring(0, 89));
            driver.Quit();
        }
 public void FirefoxStartup()
 {
     FirefoxDriver dr = new FirefoxDriver();
     dr.Manage().Window.Maximize();
     dr.Navigate().GoToUrl(url);
     dr.Quit();
 }
        public void Providing_correct_credentials_logs_user_on()
        {
            IWebDriver browser = new FirefoxDriver();

            browser.Navigate().GoToUrl("http://localhost:3000");

            browser.FindElement(By.Id("login_link")).Click();
            browser.FindElement(By.Id("username")).SendKeys("testuser");
            browser.FindElement(By.Id("password")).SendKeys("abc123");
            browser.FindElement(By.Id("login_button")).Click();

            WebDriverWait wait =
                new WebDriverWait(browser,
                    TimeSpan.FromSeconds(10));
            IWebElement menuElement =
                wait.Until<IWebElement>((d) =>
            {
                return d.FindElement(
                    By.XPath("id('description')"));
            });

            string text = browser.FindElement(By.XPath("id('top-menu')/a[3]")).Text;
            Assert.AreEqual("Logout", text);

            Assert.IsTrue(
                browser.FindElement(
                    By.XPath("id('top-menu')/a[3]")).GetAttribute("href").EndsWith("/logout"));

            browser.Quit();
        }
Exemple #26
0
        public void SimpleNavigationTest()
        {
            // Create a new instance of the Firefox driver.

            // Notice that the remainder of the code relies on the interface,
            // not the implementation.

            // Further note that other drivers (InternetExplorerDriver,
            // ChromeDriver, etc.) will require further configuration
            // before this example will work. See the wiki pages for the
            // individual drivers at http://code.google.com/p/selenium/wiki
            // for further information.
            IWebDriver driver = new FirefoxDriver();

            //Notice navigation is slightly different than the Java version
            //This is because 'get' is a keyword in C#
            driver.Navigate().GoToUrl("http://www.google.com/");

            // Find the text input element by its name
            IWebElement query = driver.FindElement(By.Name("q"));

            // Enter something to search for
            query.SendKeys("Cheese");

            // Now submit the form. WebDriver will find the form for us from the element
            query.Submit();

            // Google's search is rendered dynamically with JavaScript.
            // Wait for the page to load, timeout after 10 seconds
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            wait.Until((d) => { return d.Title.ToLower().StartsWith("cheese"); });

            //Close the browser
            driver.Quit();
        }
Exemple #27
0
        public void Visibility_NewTwitter()
        {
            var browser = new FirefoxDriver();
            browser.Navigate().GoToUrl("http://www.twitter.com");

            browser.FindElementByName("session[username_or_email]").SendKeys("theuser");
            browser.FindElementByName("session[password]").SendKeys("thepass");
        }
        public void GivenIAmOnTheQAWorksAndClick()
        {
            IWebDriver driver = new FirefoxDriver();

               driver.Navigate().GoToUrl("site");
               IWebElement contact = driver.FindElement(By.LinkText("contact"));
               contact.Click();
        }
Exemple #29
0
 public void shouldNotUserBeAbleToLoginIn()
 {
     IWebDriver driver = new FirefoxDriver();
     driver.Navigate().GoToUrl("https://id.theguardian.com/signin");
     var loginPage = new LoginPage(driver);
     var MainEntryPage = loginPage.LogIn(badEmail, goodPassWord);
     Assert.IsFalse(MainEntryPage != null);
 }
Exemple #30
0
 /// <summary>
 /// used to start mozilla FireFox
 /// </summary>
 /// <param name="Url">site url</param>
 /// <returns></returns>
 /// 
 public IWebDriver StartFF(string Url)
 {
     IWebDriver startSearch = new FirefoxDriver();
        startSearch.Navigate().GoToUrl(Url);
        //needed for slow firefox startup
        Thread.Sleep(5000);
        return startSearch;
 }
Exemple #31
0
    static void Main()
    {
        using (var driver = new OpenQA.Selenium.Firefox.FirefoxDriver(AppDomain.CurrentDomain.BaseDirectory))
        {
            driver.Navigate().GoToUrl("https://www.bing.com/");
            driver.FindElement(By.Id("sb_form_q")).SendKeys("Selenium WebDriver");
            driver.FindElement(By.Id("sb_form_go")).Click();

            Console.WriteLine("OK");
            Console.ReadKey(intercept: true);
        }
    }
        static void Main(string[] args)
        {   // test with firefox
            IWebDriver driver = new OpenQA.Selenium.Firefox.FirefoxDriver();

            // test with IE
            //InternetExplorerOptions options = new InternetExplorerOptions();
            //options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
            //IWebDriver driver = new OpenQA.Selenium.IE.InternetExplorerDriver(options);
            SetupTest();
            driver.Navigate().GoToUrl(baseURL + "Account/Login.aspx");
            IWebElement inputTextUser = driver.FindElement(By.Id("MainContent_LoginUser_UserName"));

            inputTextUser.Clear();
            driver.FindElement(By.Id("MainContent_LoginUser_UserName")).Clear();
            driver.FindElement(By.Id("MainContent_LoginUser_UserName")).SendKeys("usuario");
            driver.FindElement(By.Id("MainContent_LoginUser_Password")).Clear();
            driver.FindElement(By.Id("MainContent_LoginUser_Password")).SendKeys("123");
            driver.FindElement(By.Id("MainContent_LoginUser_LoginButton")).Click();
            driver.Navigate().GoToUrl(baseURL + "finanzas/consulta.aspx");
            // view combo element
            IWebElement comboBoxSistema = driver.FindElement(By.Id("MainContent_rcbSistema_Arrow"));

            //Then click when menu option is visible
            comboBoxSistema.Click();
            System.Threading.Thread.Sleep(500);
            // container of elements systems combo
            IWebElement listaDesplegableComboSistemas = driver.FindElement(By.Id("MainContent_rcbSistema_DropDown"));

            listaDesplegableComboSistemas.FindElement(By.XPath("//li[text()='BOMBEO MECANICO']")).Click();
            System.Threading.Thread.Sleep(500);
            IWebElement comboBoxEquipo = driver.FindElement(By.Id("MainContent_rcbEquipo_Arrow"));

            //Then click when menu option is visible
            comboBoxEquipo.Click();
            System.Threading.Thread.Sleep(500);
            // container of elements equipment combo
            IWebElement listaDesplegableComboEquipos = driver.FindElement(By.Id("MainContent_rcbEquipo_DropDown"));

            listaDesplegableComboEquipos.FindElement(By.XPath("//li[text()='MINI-V']")).Click();
            System.Threading.Thread.Sleep(500);
            driver.FindElement(By.Id("MainContent_Button1")).Click();
            try
            { Assert.AreEqual("BOMBEO MECANICO_22", driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_LabelSistema\"]")).Text); }
            catch (AssertionException e)
            { verificationErrors.Append(e.Message); }
            // verify coin format $1,234,567.89 usd
            try
            { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelInversionInicial\"]")).Text, "\\$((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})? usd")); }
            catch (AssertionException e)
            { verificationErrors.Append(e.Message); }
            try
            { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelCostoOpMantto\"]")).Text, "\\$((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})? usd")); }
            catch (AssertionException e)
            { verificationErrors.Append(e.Message); }
            try
            { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelCostoEnergia\"]")).Text, "\\$((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})? usd")); }
            catch (AssertionException e)
            { verificationErrors.Append(e.Message); }
            try
            { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelcostoUnitarioEnergia\"]")).Text, "\\$((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})? usd")); }
            catch (AssertionException e)
            { verificationErrors.Append(e.Message); }
            // verify number format 1,234,567.89
            try
            { Assert.IsTrue(Regex.IsMatch(driver.FindElement(By.XPath("//*[@id=\"MainContent_RejillaRegistroFinanciero_ctl00_ctl04_labelConsumo\"]")).Text, "((,)*[0-9]*[0-9]*[0-9]+)+(\\.[0-9]{2})?")); }
            catch (AssertionException e)
            { verificationErrors.Append(e.Message); }
            System.Console.WriteLine("errores: " + verificationErrors);
            System.Threading.Thread.Sleep(20000);
            driver.Quit();
        }