public void AddPropertyDetails() { obj.ClickAddNewProperty(); // Populating the data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "PropertyDetails"); PropertyName.SendKeys(ExcelLib.ReadData(2, "PropertyName")); SearchAddress.SendKeys(ExcelLib.ReadData(2, "SearchAddress")); Description.SendKeys(ExcelLib.ReadData(2, "Description")); Number.SendKeys(ExcelLib.ReadData(2, "Number")); Street.SendKeys(ExcelLib.ReadData(2, "Street")); Suburb.SendKeys(ExcelLib.ReadData(2, "Suburb")); City.SendKeys(ExcelLib.ReadData(2, "City")); PostCode.SendKeys(ExcelLib.ReadData(2, "PostCode")); Region.SendKeys(ExcelLib.ReadData(2, "Region")); YearBuilt.SendKeys(ExcelLib.ReadData(2, "YearBuilt")); TargetRent.SendKeys(ExcelLib.ReadData(2, "TargetRent")); LandArea.SendKeys(ExcelLib.ReadData(2, "LandArea")); FloorArea.SendKeys(ExcelLib.ReadData(2, "FloorArea")); BedRooms.SendKeys(ExcelLib.ReadData(2, "Bedrooms")); BathRooms.SendKeys(ExcelLib.ReadData(2, "Bathrooms")); CarPark.SendKeys(ExcelLib.ReadData(2, "Carparks")); owneroccupied = ExcelLib.ReadData(2, "Owner Occupied"); if (owneroccupied == "Yes") { OwnerOccupied.Click(); } Next.Click(); AddFinanceDetails(); }
//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(); }
//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(); }
// Create a new Property internal void CreateProperty() { Global.ExcelLib.PopulateInCollection(Config.PropertyManagementResource.ExcelPath, "Property"); //Explicit Wait Thread.Sleep(1000); //Click on Owners tab Owners.Click(); //Click Properties option Properties.Click(); //Click on Add New Property button AddPropertybtn.Click(); Thread.Sleep(500); // ************PropertyDetails*************** //Enter Property Name PropertyName.SendKeys(Global.ExcelLib.ReadData(2, "PropertyName")); Thread.Sleep(500); //Click on Property type dropdown PropertyTypeDropdown.Click(); //Select the value from property type dropdown PropertyTypedropdownvalue.Click(); //Enter Description Description.SendKeys(Global.ExcelLib.ReadData(2, "Description")); //Enter Street Number StreetNo.SendKeys(Global.ExcelLib.ReadData(2, "StreetNumber")); //Enter Street Name StreetName.SendKeys(Global.ExcelLib.ReadData(2, "StreetName")); //Enter Suburb Suburb.SendKeys(Global.ExcelLib.ReadData(2, "Suburb")); //Enter City City.SendKeys(Global.ExcelLib.ReadData(2, "City")); //Enter Postcode Postcode.SendKeys(Global.ExcelLib.ReadData(2, "PostCode")); //Enter Region Region.SendKeys(Global.ExcelLib.ReadData(2, "Region")); //Enter Target Rent TargetRent.SendKeys(Global.ExcelLib.ReadData(2, "TargetRent")); Thread.Sleep(1000); //Click on Rent drop down //RentTypeDropdown.Click(); //Select value from Rent dropdown // RentTypeDropdownvalue.Click(); //Enter Land Area LandArea.SendKeys(Global.ExcelLib.ReadData(2, "LandArea")); //Enter Floor Area FloorArea.SendKeys(Global.ExcelLib.ReadData(2, "FloorArea")); //Enter Bedroom Bedrooms.SendKeys(Global.ExcelLib.ReadData(2, "BedRooms")); //Enter Bathroom Bathrooms.SendKeys(Global.ExcelLib.ReadData(2, "BathRooms")); //Enter CarParks Carparks.SendKeys(Global.ExcelLib.ReadData(2, "CarParks")); Thread.Sleep(1000); //Enter Year built YearBuilt.SendKeys(Global.ExcelLib.ReadData(2, "YearBuilt")); // File Upload Approach1: Send Keys /* * FileUploadbtn.SendKeys(@"C:\Users\Shahabuddin\Desktop\Rumana\testiamge.jpg"); * Thread.Sleep(1000); * photo.Click(); */ // File Upload Approach2: AutoIt- Handles windows that do not belong to browser photo.Click(); FileUploadbtn.Click(); AutoItX3 AutoIt = new AutoItX3(); AutoIt.ControlFocus("Open", "", "Edit1"); Thread.Sleep(2000); AutoIt.ControlSetText("Open", "", "Edit1", @"C:\Users\Shahabuddin\Desktop\Rumana\house2_image.jpg"); Thread.Sleep(1000); AutoIt.ControlClick("Open", "", "Button1"); //Click on Next button NextbtnProptertyDetails.Click(); // ************Financialdetails*************** //Enter Purchase Price purchaseprice.SendKeys(Global.ExcelLib.ReadData(2, "PurchasePrice")); //Enter Mortgage Mortgage.SendKeys(Global.ExcelLib.ReadData(2, "Mortgage")); //HomeValue HomeValue.SendKeys(Global.ExcelLib.ReadData(2, "HomeValue")); //Click on Home Value Type drop down HomeValueType.Click(); //Select Home Value type HomeValueTypeSelection.Click(); //Click on Add Repayment button AddRePayment.Click(); //Enter Amount RePaymentAmount.SendKeys(Global.ExcelLib.ReadData(2, "RepaymentAmount")); //Enter RepaymentStartDate RePaymentStartdate.Clear(); RePaymentStartdate.SendKeys("26/05/2018"); Thread.Sleep(500); //Enter RepaymentEndDate RePaymentEnddate.Clear(); RePaymentEnddate.SendKeys("29/06/2018"); Thread.Sleep(500); //Click on Add Expense link AddExpense.Click(); //Enter Expense Amount ExpenseAmount.SendKeys(Global.ExcelLib.ReadData(2, "ExpenseAmount")); // Enter Expense Description ExpenseDescription.SendKeys(Global.ExcelLib.ReadData(2, "ExpenseDescription")); //Enter date for ExpenseDate //ExpenseDateCalender.Clear(); ExpenseDateCalender.SendKeys("30/06/2018"); Thread.Sleep(500); //Click on Next button NextbtnFinanceDetails.Click(); // ************Tenantdetails*************** //Enter TenantEmail TenantEmail.SendKeys(Global.ExcelLib.ReadData(2, "TenantEmail")); //Click on IsmainTenant IsMainTenant.Click(); //Select IsmainTenant IsMainTenantSelectYes.Click(); //Enter Tenant FirstName TenantFirstName.SendKeys(Global.ExcelLib.ReadData(2, "TenantFirstName")); //Enter Tenant LastName TenantLastName.SendKeys(Global.ExcelLib.ReadData(2, "TenantLastName")); //Enter Tenant StartDate TenantStartDate.Clear(); TenantStartDate.SendKeys("20/06/2018"); //Enter Tenant EndDate TenantEndDate.Clear(); TenantEndDate.SendKeys("30/09/2018"); //Enter TenantRentAmount TenantRentAmount.SendKeys(Global.ExcelLib.ReadData(2, "TenantRentAmount")); Thread.Sleep(1000); //Click on PaymentfrequencyDropdown //PaymentFrequencydropdown.Click(); //Select Monthly from PaymentFrequencyDropdown //PaymentFrequencydropdownMonth.Click(); //TenantPaymentStartdate TenantPaymentStartdate.Clear(); TenantPaymentStartdate.SendKeys("10/07/2018"); Thread.Sleep(1000); //Click on PaymentDueDay drop down //PaymentDueDayDropdown.Click(); //Select PaymentDueDay value //PaymentDueDayDropdownvalue.Click(); //Click on AddNewLiabilityLink AddNewLiability.Click(); //Click on LiabilityNameDropDown // LiabilityNameDropdown.Click(); //Select Liability Name Dropdown value //LiabilityNameDropdownInsurance.Click(); //Enter LiabilityAmount //LiabilityAmount.SendKeys(Global.ExcelLib.ReadData(2,"LiabilityAmount")); try { Assert.IsTrue(SavePropertyButton.Displayed); } catch (Exception e) { Console.Write(e); } //Click on Save button SavePropertyButton.Click(); //Add Property Verification //Click on Owners tab Owners.Click(); //Click Properties option Properties.Click(); string msg1 = Global.GlobalDefinition.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/div/div[3]/div/div[1]/div/div/div[2]/div[1]/div[1]/a/h3")).Text; string Actmsg = Global.ExcelLib.ReadData(2, "CreatePropertyVerification"); Thread.Sleep(2000); if (msg1 == Actmsg) { Global.Base.test.Log(LogStatus.Pass, "Test Passed, Record has been created successfully"); Global.SaveScreenShotClass.SaveScreenshot(Global.GlobalDefinition.driver, "PropertyListAdded"); } else { Global.Base.test.Log(LogStatus.Pass, "Test Failed, Record has not created"); } }