/// <summary> /// Start New Application Driver /// Use ScholarshipApplicationData data /// </summary> public void StartApplication(ScholarshipApplicationData appData) { //********************************** //Define New Application Data string firstName = appData.firstName; string lastName = appData.lastName; int currentAge = appData.currentAge; //********************************** //Update the student new SS# and SSID# //Update New Student Name //Get the Last New Student# from filename - RunTimeData.xml //Increment to Next Student# //Save the Next Student# back to the xml file //Append the Next Student# to the Student Name // //Get the last SS# and SSID# from filename - RunTimeData.xml //Get the Last New Student# from filename - RunTimeData.xml //Get program type from Test Context //Update the Global ScholarshipApplicationData appData) string program = TestRunnerInterface.Map.testContext.program; /********************************************************** * // Don't insert SSN# and SSID# here yet * // Wait until the call to finish the application * // in case the SSN# and SSID# are intended to be blank * * var ssn = this.CalculateNextSSNNumber(program); * appData.SSN = ssn; * * Create an SSID# by replacing first 2-chars of SS# * appData.SSID = this.CalculateSSID(ssn); *********************************************************/ int nextStudentNumber = this.CalculateNextStudentNumber(program); //Append the Next Student# to the Student Name firstName += "-" + nextStudentNumber.ToString(); lastName += "-" + nextStudentNumber.ToString(); //Click menu TestRunnerInterface.Map.menu.NewScholarshipApplication(); //Set Application Peroid = 2nd Option //FY 2017 //FY 2016 TestRunnerInterface.Map.studentSearchPage.SetListBox("ddlApplicationPeriod", 1); //Search for Student and create new application IWebDriver browser = TestRunnerInterface.Map.safePage.browser; //Auto calculate DOB based on Age //Enter DOB //DOB must be => 3-years old and <= 22-years old //string DOB = Libary.CalculateDOBByYear(currentAge); //Hard Code the DOB //string DOB = "01/01/2000"; //Use DOB from the Application Data string DOB = appData.DOB; IWebElement element = Libary.GetPageElement(browser, RunTimeVars.ELEMENTSEARCH.ID, "txtDateofBirth", RunTimeVars.REPEAT_TIMES); element.SendKeys(DOB + Keys.Return); //Enter Firstname element = Libary.GetPageElement(browser, RunTimeVars.ELEMENTSEARCH.ID, "txtFirstName", RunTimeVars.REPEAT_TIMES); element.SendKeys(firstName); //Enter Lastname element = Libary.GetPageElement(browser, RunTimeVars.ELEMENTSEARCH.ID, "txtLastName", RunTimeVars.REPEAT_TIMES); element.SendKeys(lastName); //Locate Search button //<input type="submit" value="Search" name="Search"> //*[@id="myTable1"]/tbody/tr/td/table/tbody/tr[7]/td/input[1] // //<input type="reset" value="Reset" onclick="ClearSearch()"> //*[@id="myTable1"]/tbody/tr/td/table/tbody/tr[7]/td/input[2] IWebElement myTable1 = browser.FindElement(By.Id("myTable1")); //IWebElement search = myTable1.FindElement(By.XPath("//tbody/tr/td/table/tbody/tr[7]/td/input[1]")); IWebElement search = myTable1.FindElement(By.XPath("//input[@type='submit' and @value='Search']")); //IWebElement reset = myTable1.FindElement(By.XPath("//tbody/tr/td/table/tbody/tr[7]/td/input[2]")); IWebElement reset = myTable1.FindElement(By.XPath("//input[@type='reset' and @value='Reset']")); //************************************************************* // Isuse - Unless the New Student Application is Maximized // the left most controls are hidden and can't be accessed // //Maximize the browser to set New Student Application //to the middle he screen // Then restore the browser back to orginal size //************************************************************* //Maxamize the browser System.Drawing.Size browserSize = Libary.BrowserMaximize(browser); search.Click(); //Wait for Search Results TestRunnerInterface.Map.student.WaitForNewStudentSearch(RunTimeVars.REPEAT_TIMES); //Click Here to create new application IWebElement dialog = Libary.GetPageElement(browser, RunTimeVars.ELEMENTSEARCH.ID, "dialog-SearchResults", RunTimeVars.REPEAT_TIMES); IWebElement here = dialog.FindElement(By.LinkText("HERE")); here.Click(); //Create new Student Application TestRunnerInterface.Map.student.NewStudentApplication(appData); //Wait for Student Tab to be displayed TestRunnerInterface.Map.studentTab.WaitForStudentTabDisplay(RunTimeVars.REPEAT_TIMES); //Reset browser back to orginal size Libary.SetBrowserSize(browser, browserSize); }