public void VerifyDonorSuite(string donorid, string grade) { if (donorid != "NONE") { Waits.WaitForElementToBeVisible(GetDNRRadioBtnLocator(donorid), Core.WaitType.Small); } else { Waits.WaitForElementToBeVisible(btnnew, Core.WaitType.Small); } CommonActions.WaitForPageLoad(); Report.LogInfo("Donor: DGM" + donorid + " is returned with grade " + grade); Report.TakeScreenshot(); if (donorid != "NONE") { Verify.ExactTextInElementIs(strrtndnid, "DGM" + donorid); Verify.ExactTextInElementIs(strrtngrade, grade); } else { Verify.ElementIsNotPresent(rtndata); } //clear the screen Actions.Click(btnclear); CommonActions.WaitForPageLoad(); }
public string ClickOnIdentifier(int identifier) { // ReadOnlyCollection<IWebElement> lstIdentifier = Actions.FindElements(_elementListIdentifier); // for (int i = 0; i < lstIdentifier.Count; i++) // { // IWebElement str = lstIdentifier[i]; // Console.WriteLine(str); // if (i == identifier) // { // Thread.Sleep(2000); // String strelem = lstIdentifier[i].Text; // lstIdentifier[i].Click(); // Thread.Sleep(5000); Actions.Click(_elementIdentifierLink); Thread.Sleep(500); Waits.WaitForElementToBeVisible(_elementListIdentifier, WaitType.Large); Actions.Click(_elementListIdentifier); //Thread.Sleep(1000); if (Actions.IsDisplayed(_elementDrCeDonorIDText)) { donorIDText = Actions.GetText(_elementDrCeDonorIDText); } // Console.WriteLine("TEXT name is on first identifir here" + strelem); return(donorIDText); }
public void NullLoginVerify() { CommonActions.WaitForPageLoad(); Report.LogInfo("Null login message is displayed"); Report.TakeScreenshot(); Waits.WaitForElementToBeVisible(txterror, Core.WaitType.Small); }
public void TypeNoteText(string text) { //WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(5)); //wait.Until(ExpectedConditions.ElementIsVisible(_elementNoteText)); Waits.WaitForElementToBeVisible(_elementNoteText, WaitType.Medium); Actions.SendKeys(_elementNoteText, text); Console.WriteLine("Typed text body for Note pop-up"); }
public void UserIsOnCreatePageOfAnalysis() { Actions.SwitchToDefaultFrame(); Waits.WaitForElementToBeVisible(lblTableA1CreatePage, WaitType.Large); String TableLable = Actions.GetText(lblTableA1CreatePage); try { if (TableLable.Equals("Table A-1 Selected Information by State and Region")) { Report.LogInfo("User is on create page of Table report:" + TableLable); } } catch (Exception ex) { } }
public void EnterDriveDate() { Verify.ExactPageTitle("BC-Onsite (Activate Drive)"); Actions.SendKeys(txtdrivedate, Keys.Control + "a"); Actions.SendKeys(txtdrivedate, Keys.Delete); CommonActions.SetText(txtdrivedate, "03/02/2019"); Actions.SendKeys(txtdrivedate, Keys.Enter); Waits.WaitForElementToBeVisible(gridresults, WaitType.Small); CommonActions.WaitForPageLoad(); Waits.WaitForElementToBeClickable(rdodrive, WaitType.Small); Actions.Click(rdodrive); Report.TakeScreenshot(); Actions.Click(btnselectdrive); Report.TakeScreenshot(); CommonActions.SetText(txtconfirmdrive, "DRV0166701"); Report.TakeScreenshot(); //Actions.Click(btnok); //Waits.WaitForPageLoad(); //Verify.ExactPageTitle("BC-Onsite (Onsite Menu)"); //Verify.ElementContainsText(txtdriveidfooter, "DRV0166698"); }
public void EnterLoginCredentials(string UserName, string Password) { try { Waits.WaitForElementToBeVisible(txtUserName, WaitType.Large); Actions.Clear(txtUserName); Actions.SendKeys(txtUserName, UserName); Actions.Clear(txtPassword); Actions.SendKeys(txtPassword, Password); //Waits.WaitForElementToBeClickable(btnSignin, WaitType.Large); //Actions.ExecuteJavascript("document.querySelector(\"[classname$='btn btn-primary btn-lg']\").click()"); Actions.Click(btnSignin); //Synch up Actions.SwitchToDefaultFrame(); Waits.WaitForElementToBeVisible(btnSignOut, WaitType.Large); } catch (Exception ex) { try { Report.LogInfo("Exception occured during Login due to: " + ex.Message + "Trying to login again"); this.Logout(); Actions.Clear(txtUserName); Actions.SendKeys(txtUserName, UserName); Actions.Clear(txtPassword); Actions.SendKeys(txtPassword, Password); //Waits.WaitForElementToBeClickable(btnSignin, WaitType.Large); Actions.Click(btnSignin); //Actions.ExecuteJavascript("document.querySelector(\"[id$='CtrlLogin1_cmdLogin']\").click()"); } catch (Exception exp) { Report.LogError("Not able to login into iConnect Application"); throw new Exception(exp.Message.ToString() + Environment.NewLine + exp.StackTrace.ToString() + Environment.NewLine + exp.InnerException.ToString()); } } Report.LogInfo("Logged into iConnect Application as user==>" + UserName); }
public DonorCollectionEventsPage EnterValuesInCollectionDataFields(int RandomNumbers, string RandomNames) { String strdonorIDText = string.Empty; String StartDate = GetFutureDate(1); String EndDate = GetFutureDate(2); List <object> mylist = new List <object> { strdonorIDText, StartDate, "0000", EndDate, "0001" }; Actions.Click(_elementDrCeCollDataPlusSign); Waits.WaitForElementToBeVisible(By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txtCollectionID_0"), WaitType.Medium); //Thread.Sleep(4000); Actions.Click(By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txtCollectionID_0")); Actions.FindElement(By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txtCollectionID_0")).SendKeys(mylist[0].ToString()); //Below method is for selecting values from Add Collection Event page for "CollectionID", "StartDate", "StartTime", "EndDate", "EndTime" for (int i = 0; i < DrCeTextFieldsOfCollectionData.Length - 1; i++) { By _elementDrCeTextFields = By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txt" + DrCeTextFieldsOfCollectionData[i] + "_0"); By _elementDrCeTextFieldsNext = By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txt" + DrCeTextFieldsOfCollectionData[i + 1] + "_0"); //Thread.Sleep(2000); if (Actions.FindElement(_elementDrCeTextFields).Displayed) { Actions.FindElement(_elementDrCeTextFields).SendKeys(Keys.Tab); Waits.WaitForElementToBeVisible(_elementDrCeTextFields, WaitType.Small); //Thread.Sleep(1000); Actions.FindElement(_elementDrCeTextFieldsNext).SendKeys(mylist[i + 1].ToString()); } } /* * //Below method is for selecting values from Add Collection Event page for "TimeZone", "Collector", "ProductDescriptionCode", "DonationType" * for (int j = 0; j < DrCeDDLOfCollectionData.Length; j++) * { * Console.WriteLine("Now clicking on Drop Down List of : " + DrCeDDLOfCollectionData[j] + "======"); * By _elementDrCeDDLOfCollectionDataFields = By.XPath("//select[@id='ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_ddl" + DrCeDDLOfCollectionData[j] + "_0']//option[text()]"); * * ReadOnlyCollection<IWebElement> ListDrCeDDLOfCollectionDataFields = Actions.FindElements(_elementDrCeDDLOfCollectionDataFields); * IList<string> strList = new List<string>(); * //Thread.Sleep(1000); * for (int i = 0; i < ListDrCeDDLOfCollectionDataFields.Count; i++) * { * strList.Add(ListDrCeDDLOfCollectionDataFields[i].Text); * } * string[] valuesFromDropDown = strList.ToArray(); * foreach (string strValues in valuesFromDropDown) * { * Console.Write("Values present in drop drop list : " + strValues + ","); * Console.WriteLine(); * } * for (int i = 0; i < ListDrCeDDLOfCollectionDataFields.Count; i++) * { * if (i == 0) * { * ListDrCeDDLOfCollectionDataFields[i].Click(); * * Console.WriteLine(ListDrCeDDLOfCollectionDataFields[i].Text + " is selected from the " + DrCeDDLOfCollectionData[j] + " dropDown"); * } * } * } */ //Below method is for selecting values from Add Collection Event page for "TimeZone", "Collector", "ProductDescriptionCode", "DonationType" for (int j = 0; j < DrCeDDLOfCollectionData.Length; j++) { Console.WriteLine("Now clicking on Drop Down List of : " + DrCeDDLOfCollectionData[j] + "======"); By _elementDrCeDDLOfCollectionDataFields = By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_ddl" + DrCeDDLOfCollectionData[j] + "_0"); Actions.SelectByRandoxIndex(_elementDrCeDDLOfCollectionDataFields); Console.WriteLine(Actions.GetAttributeValue(_elementDrCeDDLOfCollectionDataFields, "value") + " is selected from " + DrCeDDLOfCollectionData[j]); } return(CreateInstance <DonorCollectionEventsPage>()); }
// Type entry in Description public void TypeDocDescription(string text) { Waits.WaitForElementToBeVisible(_elementDocDescription, WaitType.Medium); Actions.SendKeys(_elementDocDescription, text); Console.WriteLine("Typed document description"); }
//User navigates to page Analysis //public void UserNavigatesToPage(string Menu) //{ // Actions.SwitchToDefaultFrame(); // Actions.Click(lnkAnalysis); //} public void ClickOnTableAReport() { //SelectTableAAnalysisReport(lnkTableA1); Waits.WaitForElementToBeVisible(lnkTableA1, WaitType.Large); Actions.Click(lnkTableA1); }
public void EnterValuesInCollectionDataFields() { String strdonorIDText = donorIDText + "-1"; String StartDate = GetFutureDate(1); String EndDate = GetFutureDate(2); List <object> mylist = new List <object> { strdonorIDText, StartDate, "0000", EndDate, "0001" }; Actions.Click(_elementDrCeCollDataPlusSign); Thread.Sleep(4000); Actions.Click(By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txtCollectionID_0")); Actions.FindElement(By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txtCollectionID_0")).SendKeys(mylist[0].ToString()); //Below method is for selecting values from Add Collection Event page for "CollectionID", "StartDate", "StartTime", "EndDate", "EndTime" for (int i = 0; i < DrCeTextFieldsOfCollectionData.Length - 1; i++) { By _elementDrCeTextFields = By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txt" + DrCeTextFieldsOfCollectionData[i] + "_0"); By _elementDrCeTextFieldsNext = By.Id("ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_txt" + DrCeTextFieldsOfCollectionData[i + 1] + "_0"); Thread.Sleep(2000); if (Actions.FindElement(_elementDrCeTextFields).Displayed) { Actions.FindElement(_elementDrCeTextFields).SendKeys(Keys.Tab); Waits.WaitForElementToBeVisible(_elementDrCeTextFields, WaitType.Small); Thread.Sleep(1000); Actions.FindElement(_elementDrCeTextFieldsNext).SendKeys(mylist[i + 1].ToString()); } } //Below method is for selecting values from Add Collection Event page for "TimeZone", "Collector", "ProductDescriptionCode", "DonationType" for (int j = 0; j < DrCeDDLOfCollectionData.Length; j++) { Console.WriteLine("Now clicking on Drop Down List of : " + DrCeDDLOfCollectionData[j] + "======"); By _elementDrCeDDLOfCollectionDataFields = By.XPath("//select[@id='ContentPlaceHolder1_ctrlCollectionEvent_gvEventDate_ddl" + DrCeDDLOfCollectionData[j] + "_0']//option[text()]"); ReadOnlyCollection <IWebElement> ListDrCeDDLOfCollectionDataFields = Actions.FindElements(_elementDrCeDDLOfCollectionDataFields); IList <string> strList = new List <string>(); Thread.Sleep(1000); for (int i = 0; i < ListDrCeDDLOfCollectionDataFields.Count; i++) { strList.Add(ListDrCeDDLOfCollectionDataFields[i].Text); } String[] valuesFromDropDown = strList.ToArray(); foreach (string strValues in valuesFromDropDown) { Console.Write("Values present in drop drop list : " + strValues + ","); Console.WriteLine(); } for (int i = 0; i < ListDrCeDDLOfCollectionDataFields.Count; i++) { if (i == 0) { ListDrCeDDLOfCollectionDataFields[i].Click(); Console.WriteLine(ListDrCeDDLOfCollectionDataFields[i].Text + " is selected from the " + DrCeDDLOfCollectionData[j] + " dropDown"); } } } }