/// <summary> /// Selects Year Group based on the Year Group Count /// </summary> public void SelectNoOfYearGroups(int NoOfYearGroups) { waiter.Until(ExpectedConditions.TextToBePresentInElement(GroupHeader, "School Groups")); waiter.Until(ExpectedConditions.PresenceOfAllElementsLocatedBy(YearGroupsCheckBox)); ReadOnlyCollection <IWebElement> YearGroupCheckboxlistYG = WebContext.WebDriver.FindElements(YearGroupsCheckBox); int i = 0; foreach (IWebElement YearGroupElem in YearGroupCheckboxlistYG) { if (YearGroupElem.Displayed == true && NoOfYearGroups != 0) { waiter.Until(ExpectedConditions.ElementToBeClickable(YearGroupElem)); if (YearGroupElem.Selected == false) { YearGroupElem.Click(); i++; } } if (i == NoOfYearGroups) { break; } } }
public void CreateMarksheetForYearGroup(int NoOfYearGroups) { SeleniumHelper.NavigateMenu("Tasks", "Assessment", "Set Up Marksheets and Parental Reports"); WebDriverWait waiter = new WebDriverWait(WebContext.WebDriver, TimeSpan.FromSeconds(MarksheetConstants.Timeout)); waiter.Until(ExpectedConditions.ElementExists(By.LinkText("Create Marksheet"))); IWebElement createMarksheetLink = WebContext.WebDriver.FindElement(By.LinkText("Create Marksheet")); createMarksheetLink.Click(); WaitUntilDisplayed(MarksheetConstants.MarksheetWithLevels); WaitForAndClick(BrowserDefaults.TimeOut, MarksheetConstants.MarksheetWithLevels); WaitUntilDisplayed(BrowserDefaults.TimeOut, By.CssSelector("[name='MarksheetTemplateName']")); WebContext.WebDriver.FindElement(By.CssSelector("[name='MarksheetTemplateName']")).SendKeys("hoy marksheet1"); WaitUntilDisplayed(BrowserDefaults.TimeOut, By.LinkText("School Groups")); WaitForAndClick(BrowserDefaults.TimeOut, By.LinkText("School Groups")); // waiter.Until(ExpectedConditions.TextToBePresentInElement(GroupHeader, "School Groups")); ReadOnlyCollection <IWebElement> YearGroupCheckboxlistYG = WebContext.WebDriver.FindElements(By.CssSelector("input[name='YearGroups.SelectedIds']")); int i = 0; foreach (IWebElement YearGroupElem in YearGroupCheckboxlistYG) { if (YearGroupElem.Displayed == true && NoOfYearGroups != 0) { waiter.Until(ExpectedConditions.ElementToBeClickable(YearGroupElem)); YearGroupElem.Click(); i++; } if (i == NoOfYearGroups) { break; } } WebContext.WebDriver.FindElement(By.CssSelector("[data-automation-id='save_button']")).Click(); }