Ejemplo n.º 1
0
        public void ThenIWantAPrintOutOfDetailsOnThePage(string details)
        {
            IList <IWebElement> elements = null;

            //Swicth code path based on scenario
            switch (details)
            {
            case "NewsHeadlines":
                //Get all elements with headlines
                elements = driver.FindElements(By.XPath(GoogleNewsPage.Headlines));
                break;

            case "LiveGames":
                //Get the Live Now link element
                IWebElement LiveNowLink = driver.FindElement(By.XPath(BetwayPage.LiveNowLink));
                //Wait for Live Now link to be displayed
                FunctionLibrary.WaitForElement(LiveNowLink, 5);
                //Click the Live Now link
                LiveNowLink.Click();
                //Get all Live Games displayed on page
                elements = driver.FindElements(By.XPath(BetwayPage.LiveGames));
                break;
            }

            driver = null;
            //Print out the list to Excel file
            FunctionLibrary.PrintoutToExcel(elements, details);
        }