/// <summary> /// Admin checks the status of a loan /// </summary> /// <param name="userToApprove"></param> /// <param name="currTestContext"></param> /// <param name="screenShotDir"></param> public string CheckLoanStatus(string userToCheck, TestContext currTestContext, string screenShotDir) { string Status = ""; try { PageFactory.InitElements(BaseWebDriver, this); userToCheck = "\"" + userToCheck + "\""; var applicantCollection = BaseWebDriver.FindElements(By.XPath("//*[text()= " + userToCheck + " ]")); applicantCollection[0].Click(); PageFactory.InitElements(BaseWebDriver, this); //Take screenshot after admin approves of a loan var fileName = TakeScreenShot(currTestContext, screenShotDir); // store filename if (fileName != null) { ScreenshotFileCollnt.Add(fileName); } Status = (LblApprovalStatus != null & LblApprovalStatus.Displayed) ? LblApprovalStatus.Text : ""; } catch (Exception) { } return(Status); }
/// <summary> /// Admin Approves of a loan /// </summary> /// <param name="userToApprove"></param> /// <param name="currTestContext"></param> /// <param name="screenShotDir"></param> public void ApproveLoan(string userToApprove, TestContext currTestContext, string screenShotDir) { try { PageFactory.InitElements(BaseWebDriver, this); userToApprove = "\"" + userToApprove + "\""; var applicantCollection = BaseWebDriver.FindElements(By.XPath("//*[text()= " + userToApprove + " ]")); applicantCollection[0].Click(); //Take screenshot before admin approves of a loan var fileName = TakeScreenShot(currTestContext, screenShotDir); // store filename if (fileName != null) { ScreenshotFileCollnt.Add(fileName); } PageFactory.InitElements(BaseWebDriver, this); BtnApprove.Click(); } catch (Exception) { } }
/// <summary> /// close default alert based on option provided /// </summary> /// <param name="text">The name of the text of the alert</param> /// <returns>True if alert clicked ok, false otherwise</returns> public bool ClickPopupButtonWithText(string text) { bool FoundTextToClick = false; try { var PopupButtn = BaseWebDriver.FindElements(By.XPath("//*[contains(text(), \"" + text + "\") ]")); if (PopupButtn.Count == 1) { PopupButtn[0].Click(); FoundTextToClick = true; } } catch (Exception) { FoundTextToClick = false; } return(FoundTextToClick); }
/// <summary> /// Find an elememt by CLASSNAME attribute /// </summary> /// <param name="elementByClassName"></param> /// <returns>The element found</returns> public IWebElement FindElementByClassName(string elementByClassName) { var elements = BaseWebDriver.FindElements(By.ClassName(elementByClassName)); return(elements.Count == 1 ? elements[0] : null); }
/// <summary> /// Find an elememt by LINText attribute /// </summary> /// <param name="elementByLinkText"></param> /// <returns>The element found</returns> public IWebElement FindElementByLinkText(string elementByLinkText) { var elements = BaseWebDriver.FindElements(By.LinkText(elementByLinkText)); return(elements.Count == 1 ? elements[0] : null); }
/// <summary> /// Find an elememt by CSS attribute /// </summary> /// <param name="elementByCSS"></param> /// <returns>The element found</returns> public IWebElement FindElementByCSS(string elementByCSS) { var elements = BaseWebDriver.FindElements(By.CssSelector(elementByCSS)); return(elements.Count == 1 ? elements[0] : null); }
/// <summary> /// Find an elememt by XPATH attribute /// </summary> /// <param name="elementByXPath"></param> /// <returns>The element found</returns> public IWebElement FindElementByXPath(string elementByXPath) { var elements = BaseWebDriver.FindElements(By.XPath(elementByXPath)); return(elements.Count == 1 ? elements[0] : null); }
/// <summary> /// Find an elememt by ID attribute /// </summary> /// <param name="elementByID"></param> /// <returns>The element found</returns> public IWebElement FindElementByID(string elementByID) { var elements = BaseWebDriver.FindElements(By.Id(elementByID)); return(elements.Count == 1 ? elements[0] : null); }
/// <summary> /// Find an elememt that contains a text /// </summary> /// <param name="elementContainsText"></param> /// <returns>The element found</returns> public IWebElement FindElementByText(string elementContainsText) { var elements = BaseWebDriver.FindElements(By.XPath("//*[contains(text(), \"" + elementContainsText + "\") ]")); return(elements.Count == 1 ? elements[0] : null); }