//Fill out tenant details form internal void AddTenantDetails() { ExcelLib.PopulateInCollection(Base.ExcelPath, "Tenant Details"); // Navigating to Property Details using value from Excel TenantEmailText.SendKeys(ExcelLib.ReadData(2, "Tenant Email")); FirstnameText.SendKeys(ExcelLib.ReadData(2, "First Name")); LastnameText.SendKeys(ExcelLib.ReadData(2, "Last Name")); StartDatePicker.Click(); EndDatePicker.Click(); RentAmountText.SendKeys(ExcelLib.ReadData(2, "Rent Amount")); PaymentStartDatePicker.Click(); }
//Fill out the tenant form internal void AddTenantDetails() { ExcelLib.PopulateInCollection(Base.ExcelPath, "Add Tenant"); //enter the tenant email TenantEmailText.SendKeys(ExcelLib.ReadData(2, "Tenant Email")); //select is main tenant String isMainTenant = ExcelLib.ReadData(2, "Is Main Tenant"); SelectElement select1 = new SelectElement(IsMainTenantDropdown); switch (isMainTenant) { case "Yes": select1.SelectByValue("true"); break; case "No": select1.SelectByValue("false"); break; } try { //enter first name and last name Thread.Sleep(1000); FirstNameText.SendKeys(ExcelLib.ReadData(2, "First Name")); Thread.Sleep(1000); LastNameText.SendKeys(ExcelLib.ReadData(2, "Last Name")); } catch (Exception e) { Console.Write("enter first name and last name exception: " + e.Message); } //select rent start date string rentStartDate = ExcelLib.ReadData(2, "Rent Start Date"); string[] temp = rentStartDate.Split(' '); rentStartDate = temp[0]; RentStartDatepicker.Click(); RentStartDatepicker.Clear(); RentStartDatepicker.SendKeys(rentStartDate); //select rent end date string rentEndDate = ExcelLib.ReadData(2, "Rent End Date"); temp = rentEndDate.Split(' '); rentEndDate = temp[0]; RentEndDatepicker.Click(); RentEndDatepicker.Clear(); RentEndDatepicker.SendKeys(rentEndDate); //enter rent amount RentAmountText.SendKeys(ExcelLib.ReadData(2, "Rent Amount")); //select payment frequency String paymentFrequency = ExcelLib.ReadData(2, "Payment Frequency"); SelectElement select2 = new SelectElement(PaymentFrequencyDropdown); switch (paymentFrequency) { case "Weekly": select2.SelectByValue("1"); break; case "Fortnightly": select2.SelectByValue("2"); break; case "Monthly": select2.SelectByValue("3"); break; } //select payment start date string PaymentStartDate = ExcelLib.ReadData(2, "Payment Start Date"); temp = PaymentStartDate.Split(' '); PaymentStartDate = temp[0]; PaymentStartDatepicker.Click(); PaymentStartDatepicker.Clear(); PaymentStartDatepicker.SendKeys(PaymentStartDate); //select payment due date String paymentDuedate = ExcelLib.ReadData(2, "Payment Due Date"); SelectElement select3 = new SelectElement(PaymentDueDateDropdown); switch (paymentDuedate) { case "1": select3.SelectByValue("1"); break; case "2": select3.SelectByValue("2"); break; case "3": select3.SelectByValue("3"); break; case "4": select3.SelectByValue("4"); break; case "5": select3.SelectByValue("5"); break; case "6": select3.SelectByValue("6"); break; case "7": select3.SelectByValue("7"); break; } }