//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); } }
//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(); }
public void TenantDetails() { //Enter email Email.SendKeys(ExcelLib.ReadData(2, "TenantEmail")); Driver.wait(1000); //Enter FirstName FirstName.SendKeys(ExcelLib.ReadData(2, "FirstName")); Driver.wait(1000); //Enter LastName LastName.SendKeys(ExcelLib.ReadData(2, "LastName")); Driver.wait(1000); //Clear Start date bar StartDate.Clear(); Driver.wait(1000); //Enter StartDate StartDate.SendKeys("12/08/2018"); Driver.wait(1000); //Clear Start date bar EndDate.Clear(); Driver.wait(1000); //Enter EndDate EndDate.SendKeys("21/08/2019"); Driver.wait(1000); //Enter Rent amount RentAmount.SendKeys(ExcelLib.ReadData(2, "RentAmount")); Driver.wait(1000); //Clear Payment Start date bar PSDate.Clear(); Driver.wait(1000); //Enter payment start date PSDate.SendKeys("15/08/2018"); Driver.wait(1000); //Clicking on Payment option drop down PaymentOpt.Click(); Driver.wait(2000); //Clicking on Payment option 2 in drop down PaymentOptTwo.Click(); Driver.wait(2000); //Clinking on Save add button SaveProperty.Click(); Driver.wait(2000); //Click(By.Id("saveProperty")); }
//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(); }
internal void GetDataFromExcel() { try { // Populating the data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "TenantDetails"); //Edit Email textbox TenantEmail.Clear(); Thread.Sleep(1000); TenantEmail.SendKeys(ExcelLib.ReadData(2, "Tenant Email")); //Edit First Name textbox FirstName.Clear(); Thread.Sleep(1000); FirstName.SendKeys(ExcelLib.ReadData(2, "First Name")); //Edit Last Name textbox LastName.Clear(); Thread.Sleep(1000); LastName.SendKeys(ExcelLib.ReadData(2, "Last Name")); //Edit Start Date picker StratDate.Clear(); Thread.Sleep(1000); StratDate.SendKeys(ExcelLib.ReadData(2, "Start Date")); //Edit End Date picker EndDate.Clear(); Thread.Sleep(1000); EndDate.SendKeys(ExcelLib.ReadData(2, "End Date")); //Edit Rent Amount textbox RentAmount.Clear(); Thread.Sleep(1000); RentAmount.SendKeys(ExcelLib.ReadData(2, "Rent Amount")); //Edit Payment Start Date picker PayStratDate.Clear(); Thread.Sleep(1000); PayStratDate.SendKeys(ExcelLib.ReadData(2, "Payment Start Date")); PayStratDate.SendKeys(Keys.Enter); Thread.Sleep(1000); //Click on the "Save" button SaveButton.Click(); Thread.Sleep(2000); } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Add Tenant Details Unsuccessfull", e.Message); } }
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); } }