//A method to enter and save a given test data set for tenant details internal bool SaveTenantDetails(int TestDataSet) { try { //Enter the testdata into the relevant input fields TenantEmail.SendKeys(ExcelLib.ReadData(TestDataSet, "TenantEmail")); FirstName.SendKeys(ExcelLib.ReadData(TestDataSet, "FirstName")); LastName.SendKeys(ExcelLib.ReadData(TestDataSet, "LastName")); StartDate.SendKeys(ExcelLib.ReadData(TestDataSet, "StartDate")); EndDate.SendKeys(ExcelLib.ReadData(TestDataSet, "EndDate")); RentAmount.SendKeys(ExcelLib.ReadData(TestDataSet, "RentAmount")); PaymentStartDate.SendKeys(ExcelLib.ReadData(TestDataSet, "PaymentStartDate")); Thread.Sleep(1000); //Click on the Save Button to Save the Property Details SaveButton.Click(); return(true); } catch (Exception e) { // Log the error details in the report Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Error, "Error Occured when entering Tenant Details for the new property: " + e.Message.ToString()); // Save Screenshot to display the error String img = SaveScreenShotClass.SaveScreenshot(Driver.driver, "Exception Report"); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Image example: " + img); return(false); } }
public void EnterTenantDet() { _Wait.Until(ExpectedConditions.ElementExists(By.XPath("//*[@id='lname']"))); TenantEmail.SendKeys("*****@*****.**"); TenantFullname.SendKeys("Tenant"); TenantLastName.SendKeys("TenantLast"); RentAmt.SendKeys("200"); /* IJavaScriptExecutor js = (IJavaScriptExecutor)_driver; * js.ExecuteScript(StartDate.startD); * * String startD = "24/09/2018"; */ StartDate.SendKeys("24/09/2018"); StartDate.Click(); System.Threading.Thread.Sleep(1000); EndDate.SendKeys("24/08/2028"); EndDate.Click(); System.Threading.Thread.Sleep(1000); PaymentStartDate.SendKeys("24/09/2018"); PaymentStartDate.Click(); System.Threading.Thread.Sleep(1000); Liabilities.Click(); _Wait.Until(ExpectedConditions.ElementExists(By.XPath("//*[@id='LiabilityDetail']/div/div[1]/div[2]/div[1]/input"))); ValLiabilities.SendKeys("1000"); ClickSave.Click(); }
//Adding Repayment,Expenses and Liabilities internal void RepaymentExpensesLiabilities() { //To skip the highlighted option SkipButton?.Click(); System.Threading.Thread.Sleep(5000); // Populating the data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "AddNewProperty"); OwnersSelect.Click(); System.Threading.Thread.Sleep(5000); PropertiesSelect.Click(); ClickingAddNewProperty.Click(); //Value set for property page details PropertyName.SendKeys(ExcelLib.ReadData(2, "Value")); SearchAddress.SendKeys(ExcelLib.ReadData(33, "Value")); System.Threading.Thread.Sleep(5000); //Value set using google api var address = Global.Driver.driver.FindElements(By.ClassName("pac-item"))[0]; address.Click(); TargetRent.SendKeys(ExcelLib.ReadData(14, "Value")); LandArea.SendKeys(ExcelLib.ReadData(10, "Value")); BedRooms.SendKeys(ExcelLib.ReadData(11, "Value")); CarParks.SendKeys(ExcelLib.ReadData(12, "Value")); Description.SendKeys(ExcelLib.ReadData(13, "Value")); FloorArea.SendKeys(ExcelLib.ReadData(15, "Value")); BathRooms.SendKeys(ExcelLib.ReadData(16, "Value")); YearBuilt.SendKeys(ExcelLib.ReadData(9, "Value")); NextButton.Click(); //Value set for financial details page System.Threading.Thread.Sleep(2000); PurchasePrice.SendKeys(ExcelLib.ReadData(17, "Value")); HomeValue.SendKeys(ExcelLib.ReadData(18, "Value")); Mortgage.SendKeys(ExcelLib.ReadData(19, "Value")); //Adding repayment option AddRepayment.Click(); RepaymentAmount.SendKeys(ExcelLib.ReadData(2, "AddRepaymentfieldValue")); RepaymentStartDate.SendKeys(ExcelLib.ReadData(3, "AddRepaymentfieldValue")); //Adding expenses option AddExpense.Click(); ExpenseAmount.SendKeys(ExcelLib.ReadData(2, "AddExpensefieldValue")); var ExpenseDescription = Global.Driver.driver.FindElement(By.ClassName("seven")).FindElement(By.ClassName("width")).FindElement(By.Id("Text1")); ExpenseDescription.SendKeys(ExcelLib.ReadData(3, "AddExpensefieldValue")); ExpenseDate.SendKeys(ExcelLib.ReadData(4, "AddExpensefieldValue")); NextButton2.Click(); //Value set for financial details page TenantEmail.SendKeys(ExcelLib.ReadData(20, "Value")); FirstName.SendKeys(ExcelLib.ReadData(21, "Value")); LastName.SendKeys(ExcelLib.ReadData(22, "Value")); StartDate.SendKeys(ExcelLib.ReadData(23, "Value")); EndDate.SendKeys(ExcelLib.ReadData(24, "Value")); RentAmount.SendKeys(ExcelLib.ReadData(25, "Value")); PaymentStartDate.SendKeys(ExcelLib.ReadData(26, "Value")); //Adding liability option NewLiability.Click(); Amount.SendKeys(ExcelLib.ReadData(2, "NewLiabilityFieldValue")); Save.Click(); }
//A method to enter and save a given test data set for tenant details for an existing property internal void SaveTenantDetails(int TestDataSet) { //Enter the testdata into the relevant input fields TenantEmail.SendKeys(ExcelLib.ReadData(TestDataSet, "TenantEmail")); RentStartDate.SendKeys(ExcelLib.ReadData(TestDataSet, "RentStartDate")); RentAmount.SendKeys(ExcelLib.ReadData(TestDataSet, "RentAmount")); PaymentStartDate.SendKeys(ExcelLib.ReadData(TestDataSet, "PaymentStartDate")); Thread.Sleep(1000); //Click on the Next Button to move to the next section TenantNextButton.Click(); }
//Add new property internal void AddingProperty() { //To skip the highlighted option SkipButton?.Click(); System.Threading.Thread.Sleep(5000); // Populating the data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "AddNewProperty"); System.Threading.Thread.Sleep(5000); OwnersSelect.Click(); System.Threading.Thread.Sleep(5000); PropertiesSelect.Click(); ClickingAddNewProperty.Click(); //Value set for property details page PropertyName.SendKeys(ExcelLib.ReadData(2, "Value")); SearchAddress.SendKeys(ExcelLib.ReadData(33, "Value")); System.Threading.Thread.Sleep(5000); //Value set using google api var address = Global.Driver.driver.FindElements(By.ClassName("pac-item"))[0]; address.Click(); TargetRent.SendKeys(ExcelLib.ReadData(14, "Value")); LandArea.SendKeys(ExcelLib.ReadData(10, "Value")); BedRooms.SendKeys(ExcelLib.ReadData(11, "Value")); CarParks.SendKeys(ExcelLib.ReadData(12, "Value")); Description.SendKeys(ExcelLib.ReadData(13, "Value")); FloorArea.SendKeys(ExcelLib.ReadData(15, "Value")); BathRooms.SendKeys(ExcelLib.ReadData(16, "Value")); YearBuilt.SendKeys(ExcelLib.ReadData(9, "Value")); imagebox.Click(); //Image upload Global.Driver.driver.FindElement(By.Id("file-upload")).Click(); System.Threading.Thread.Sleep(10000); SendKeys.SendWait("E:\\Document\\house.jpg"); System.Threading.Thread.Sleep(10000); SendKeys.SendWait(@"{Enter}"); System.Threading.Thread.Sleep(5000); NextButton.Click(); System.Threading.Thread.Sleep(5000); //Value set for financial details page PurchasePrice.SendKeys(ExcelLib.ReadData(17, "Value")); HomeValue.SendKeys(ExcelLib.ReadData(18, "Value")); Mortgage.SendKeys(ExcelLib.ReadData(19, "Value")); NextButton2.Click(); //Value set for Tenant details page TenantEmail.SendKeys(ExcelLib.ReadData(20, "Value")); FirstName.SendKeys(ExcelLib.ReadData(21, "Value")); LastName.SendKeys(ExcelLib.ReadData(22, "Value")); StartDate.SendKeys(ExcelLib.ReadData(23, "Value")); EndDate.SendKeys(ExcelLib.ReadData(24, "Value")); RentAmount.SendKeys(ExcelLib.ReadData(25, "Value")); PaymentStartDate.SendKeys(ExcelLib.ReadData(26, "Value")); Save.Click(); }
void AddTenantDetails() { ExcelLib.PopulateInCollection(Base.ExcelPath, "TenantDetails"); TenantEmail.SendKeys(ExcelLib.ReadData(2, "TenantEmail")); FirstName.SendKeys(ExcelLib.ReadData(2, "FirstName")); LastName.SendKeys(ExcelLib.ReadData(2, "LastName")); StartDate.SendKeys(ExcelLib.ReadData(2, "StartDate")); EndDate.SendKeys(ExcelLib.ReadData(2, "EndDate")); RentAmount.SendKeys(ExcelLib.ReadData(2, "RentAmount")); PaymentStartDate.SendKeys(ExcelLib.ReadData(2, "PaymentStartDate")); Save.Click(); //obj.SearchAProperty(); }
//A method to enter and save a given test data set for tenant details internal void SaveTenantDetails(int TestDataSet) { try { //Enter the testdata into the relevant input fields TenantEmail.SendKeys(ExcelLib.ReadData(TestDataSet, "TenantEmail")); FirstName.SendKeys(ExcelLib.ReadData(TestDataSet, "FirstName")); LastName.SendKeys(ExcelLib.ReadData(TestDataSet, "LastName")); StartDate.SendKeys(ExcelLib.ReadData(TestDataSet, "StartDate")); EndDate.SendKeys(ExcelLib.ReadData(TestDataSet, "EndDate")); RentAmount.SendKeys(ExcelLib.ReadData(TestDataSet, "RentAmount")); PaymentStartDate.SendKeys(ExcelLib.ReadData(TestDataSet, "PaymentStartDate")); Thread.Sleep(1000); //Click on the Save Button to Save the Property Details SaveButton.Click(); } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Error, "Error Occured when entering Tenant Details for the new property: " + e.Message.ToString()); } }
internal void TenantDetails4mExcel() { ExcelLib.PopulateInCollection(Base.ExcelPath, "TenantDetails"); Driver.wait(2); Assert.IsTrue(Driver.driver.PageSource.Contains("Tenant Email")); try { bool bEmail = TenantEmailId.Enabled; if (bEmail) { TenantEmailId.SendKeys(ExcelLib.ReadData(3, "EmailId")); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Email Id field is enabled and value from excel sheet passed"); IsMainTenant.Click(); //Verify first name field and last name is emabled or not bool bFName = TenantFirstName.Enabled; if (bFName) { TenantFirstName.SendKeys(ExcelLib.ReadData(3, "FirstName")); TenantLastName.SendKeys(ExcelLib.ReadData(3, "LastName")); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Its a new email id; First Name and Last name filled with Excel sheet"); } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "First Name & Last Name has been auto filled with the email id"); } TenantStartDate.Click(); //verify Rent amount field is enabled or not bool bRentField = RentAmount.Enabled; if (bRentField) { RentAmount.SendKeys(ExcelLib.ReadData(3, "RentAmount")); decimal d; if (decimal.TryParse(ExcelLib.ReadData(3, "RentAmount"), out d)) { PaymentFrequncy.Click(); Driver.wait(5); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Rent Amount field has been verified for decimal values"); PaymentStartDate.Click(); PaymentDueDate.Click(); if (ButtonSave.Enabled) { ButtonSave.Click(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "All the field has been entered on Add Tenant page"); } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Some of the fields on Add tenant Page need sto be cross verified, Next button is not enabled "); } } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Rent Amount field has been verified for decimal values"); } } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Rent amount field is not enabled"); } } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Email Id Field is not enabled"); } //ClickNewLiability.Click(); //LiabilityName.Click(); //LiabilityAmount.SendKeys(ExcelLib.ReadData(2, "LiabilityAmount")); //Driver.wait(5); //ButtonSave.Click(); } catch (Exception ex) { string exMesg = ex.Message; Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Exception Message thrown:" + exMesg); } }