//// Child 'Marlon Casson' under Pending Bookings //[FindsBy(How = How.LinkText, Using = "Marlon Casson")] //public IWebElement lnkChild1 { get; set; } //// Child 'Marlon Casson' under Pending Bookings //[FindsBy(How = How.LinkText, Using = "Tony Casson")] //public IWebElement lnkChild2 { get; set; } private bool ValidationBooking(IWebDriver driver, string TestName, string Name) { log.Info("Booking Manager Validation Test Case: "); AimyClick(driver, chkAllTerms); IReadOnlyCollection <IWebElement> elements = null; try { elements = WebDriverExtensions.FindElements(driver, By.LinkText(Name), 10); } catch (Exception) { if (elements == null) { log.Info("[FAIL] " + TestName); log.Info("'" + Name + "' does NOT exist under " + TestName + ". FAILED!"); return(false); } } log.Info("[PASS] " + TestName); log.Info("The child '" + Name + "' exist under " + TestName + ". PASSED!"); return(true); }
public bool IsParentBeenRestoredToParentManagePage(IWebDriver driver, string ParentName) { log.Info("Parent Archive Restore Validation Test"); Common.WaitBySleeping(GlobalVariable.iShortWait); sURL = GlobalVariable.sURL + "Parent/Management"; driver.Navigate().GoToUrl(sURL); Common.WaitBySleeping(GlobalVariable.iShortWait); IWebElement txtCategory = WebDriverExtensions.FindElement(driver, By.Id("category"), 2); AimySendKeys(driver, txtCategory, ParentName); txtCategory.SendKeys(Keys.Enter); Thread.Sleep(2000); IReadOnlyCollection <IWebElement> elements = null; try { elements = WebDriverExtensions.FindElements(driver, By.XPath("html/body/div[3]/div[3]/div[2]/table/tbody/tr[1]/td[3]/div/p[1]/b"), 10); } catch (Exception) { if (elements == null) { log.Info("[FAIL]: '" + ParentName + "' has NOT been found."); return(false); } } log.Info("[PASS]: '" + ParentName + "' has been RESTORED!"); return(true); }
public bool ValidationAttendanceExist(IWebDriver driver, string ChildName) { sURL = GlobalVariable.sURL + "RollSheet/AttendanceManager"; driver.Navigate().GoToUrl(sURL); Common.WaitBySleeping(GlobalVariable.iShortWait); IReadOnlyCollection <IWebElement> selectors = WebDriverExtensions.FindElements(driver, By.XPath("html/body/div[3]/div[5]/span[1]/span/span[2]/span"), 10); if (selectors.Count != 0) { foreach (var selector in selectors) { AimyClick(driver, selector); break; } } Common.WaitBySleeping(GlobalVariable.iShortWait); AimyClick(driver, ddlTerm3); Common.WaitBySleeping(GlobalVariable.iShortWait); bool exist = ValidationAttendance(driver, "AttendanceManager - Attendance Checking", ChildName); return(exist); }
public static IWebDriver WaitToClear(this IWebDriver driver, SelectorBase selector) { if (driver == null) { throw new ArgumentNullException("driver"); } if (selector == null) { throw new ArgumentNullException("selector"); } new WebDriverWait(driver, DefaultWaitTimeSpan).Until <bool>(d => WebDriverExtensions.FindElements(d, selector).Count < 1); return(driver); }
public bool IsParentUnlocked(IWebDriver driver, string ParentName) { Common.WaitBySleeping(GlobalVariable.iShortWait); IReadOnlyCollection <IWebElement> TableRows = WebDriverExtensions.FindElements(driver, By.XPath("html/body/div[3]/div[3]/div[2]/table/tbody/tr"), 2); for (int t = 0; t < TableRows.Count; t++) { if (TableRows.ElementAt(t) != null) { if (!String.IsNullOrEmpty(TableRows.ElementAt(t).GetAttribute("style"))) { if (TableRows.ElementAt(t).GetAttribute("style").Equals("background-color: rgb(239, 201, 201);")) { // filter for this parent IWebElement txtCategory = WebDriverExtensions.FindElement(driver, By.Id("category"), 2); AimySendKeys(driver, txtCategory, ParentName); txtCategory.SendKeys(Keys.Enter); // locate the 'profile' dropdown list WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(500)); wait.PollingInterval = TimeSpan.FromSeconds(2); wait.Until( ExpectedConditions.ElementExists(By.CssSelector("span.caret.split-dropdown-caret"))); IReadOnlyCollection <IWebElement> items = driver.FindElements(By.CssSelector("span.caret.split-dropdown-caret")); // click on 'profile'dropdown list foreach (var item in items) { item.Click(); break; } Thread.Sleep(2000); AimyClick(driver, menuItemUnlock); Thread.Sleep(2000); AimyClick(driver, buttonOK); return(true); } } } } return(true); }
public void StepsForBookingWizard1(IWebDriver driver, bool needSecondChild = false) { if (!IsFirstChildSelected(driver)) { AimyClick(driver, lblChild1); if (needSecondChild) { IReadOnlyCollection <IWebElement> elems = WebDriverExtensions.FindElements(driver, By.XPath("html/body/div[3]/div[2]/div/div[1]/div/div[2]/label"), 2); if (elems.Count >= 2) { AimyClick(driver, lblChild2); } else { throw new Exception("The second child is NOT available!!"); } } } Thread.Sleep(2000); AimyClick(driver, btnNext); }
public bool IsParentBeenRestoredFromAchiveList(IWebDriver driver, string ParentName) { log.Info("Parent Archive Restore Validation Test"); IReadOnlyCollection <IWebElement> elements = null; try { elements = WebDriverExtensions.FindElements(driver, By.LinkText("Restore"), 5); } catch (Exception) { if (elements == null) { log.Info("[PASS] We expect that there should NO '" + ParentName + "' been found."); return(true); } } log.Info("[FAIL] There is '" + ParentName + "' which should NOT be!"); return(false); }
private bool ValidationChildAchive(IWebDriver driver, string TestName) { log.Info("Children Management Validation Test Case: "); IReadOnlyCollection <IWebElement> elements = null; try { elements = WebDriverExtensions.FindElements(driver, By.LinkText("Profile"), 10); } catch (Exception) { if (elements == null) { log.Info("[PASS] " + TestName); log.Info("We expect that there should NO 'Profile' link for this parent."); return(true); } } log.Info("[FAIL] " + TestName); log.Info("There is 'Profile' link for this parent!"); return(false); }
public bool IsParentLocked(IWebDriver driver, string ParentName) { log.Info("Parent Manager - FindTheLockedParent : Validation Test Case: "); Common.WaitBySleeping(GlobalVariable.iShortWait); IReadOnlyCollection <IWebElement> TableRows = WebDriverExtensions.FindElements(driver, By.XPath("html/body/div[3]/div[3]/div[2]/table/tbody/tr"), 2); for (int t = 0; t < TableRows.Count; t++) { if (TableRows.ElementAt(t) != null) { if (!String.IsNullOrEmpty(TableRows.ElementAt(t).GetAttribute("style"))) { if (TableRows.ElementAt(t).GetAttribute("style").Equals("background-color: rgb(239, 201, 201);")) { return(true); } } } } return(false); }