Ejemplo n.º 1
0
        public static void NavigateAroundAnotherSite()
        {
            driver = new ChromeDriver();
            driver.Manage().Window.Maximize();

            //Go to Training HTML
            driver.Navigate().GoToUrl("file:///C:/Ranjit/Automation/TrainingTasks/IntroductionToAutomation/Testng.html");
            GenericFunctions.Wait(2);

            //Click on a hyperlink
            GenericFunctions.ClickOnLink("Click Me", driver);
            GenericFunctions.Wait(2);

            //Navigate Back
            driver.Navigate().Back();
            GenericFunctions.Wait(2);

            //Select a value from a Dropdown
            GenericFunctions.SelectFromList("Audi", "CarsList", driver);
            GenericFunctions.Wait(2);

            //Tick / Untick a checkbox
            GenericFunctions.TickCheckBox("Bike", driver);
            GenericFunctions.Wait(2);
            GenericFunctions.UnTickCheckBox("Bike", driver);
            GenericFunctions.Wait(2);

            //Check text is on a page.
            GenericFunctions.CheckTextIsOnPageNew("Login", driver);
            GenericFunctions.CheckTextIsOnPageNew("Username:"******"Password:"******"What transport do you have?", driver);
            GenericFunctions.CheckTextIsOnPageNew("What car do you have?", driver);

            //Check text is not on a page.
            GenericFunctions.CheckTextIsNotOnPageNew("Elephant", driver);
            GenericFunctions.CheckTextIsNotOnPageNew("Tiger", driver);
            GenericFunctions.CheckTextIsNotOnPageNew("Dog", driver);
            GenericFunctions.CheckTextIsNotOnPageNew("Cat", driver);

            //Close Browser
            GenericFunctions.Wait(2);
            driver.Quit();
        }