public List <ClassRosterSearchResult> GetSearchResults(ChromeDriver driver, NuStarWebsiteNavigator navigator, string year, string semester)
        {
            driver.FindElement(By.Id("CLASS_ROSTER")).Submit();
            var table     = driver.FindElementById("PTSRCHRESULTS");
            var tableRows = table.FindElements(By.XPath(".//tbody/tr"));

            List <ClassRosterSearchResult> results = new List <ClassRosterSearchResult>();

            var rowCount = 0;

            while (rowCount < tableRows.Count)
            {
                if (rowCount > 0)
                {
                    driver.FindElement(By.Id("CLASS_ROSTER")).Submit();
                    var row = driver.FindElementById("PTSRCHRESULTS").FindElements(By.XPath(".//tbody/tr"))[rowCount];
                    Console.WriteLine(row.FindElements(By.TagName("td")).Last().Text);
                    var newResult = new ClassRosterSearchResult(row, year, semester);

                    navigator.GoToSearchResultEnrollmentPage(row);

                    newResult.StudentsEnrolled = GetEnrollments(driver);
                    newResult.Campus           = GetCampus(driver);

                    results.Add(newResult);

                    navigator.ReturnToClassRosterSearch();
                }
                rowCount++;
            }

            return(results);
        }
        public void GetDataFromNuStarWebsite(IConsoleReader consoleReader, ISaveFilePathMaker saveFilePathMaker)
        {
            var userInputs = GetInputFromUser(consoleReader);
            var dbOrExcel  = consoleReader.AddToDb();

            using (var driver = new ChromeDriver(@"E:\CoursePathwayMaker\CoursePathwayMaker\bin\Debug"))
            {
                Console.WriteLine("Scraper navigating to NuStar website...");


                //var subjectArea = consoleReader.GetSubjectArea();
                //var term = consoleReader.GetTerm();
                //var year = consoleReader.GetStartYear().ToString();
                //var semester = consoleReader.GetSemester();

                var navigator = new NuStarWebsiteNavigator(driver);
                navigator.NavigateToUonWebsite();
                navigator.LoginIfNecessary();
                navigator.NavigateToUonWebsiteAgain();
                List <ClassRosterSearchResult> results = new List <ClassRosterSearchResult>();
                foreach (var sem in userInputs)
                {
                    navigator.FillSearchFilters(sem.SubjectArea, sem.Term);
                    results.AddRange(GetSearchResults(driver, navigator, sem.Year.ToString(), sem.Semester.ToString()));
                    navigator.ClearSearchFields();
                }

                if (dbOrExcel == true)
                {
                    SaveResultsInDb(results);
                }
                else
                {
                    SaveResultsInExcelWorksheet(results, saveFilePathMaker);
                }
            }
        }