internal void Empty_property() { try { ExcelLib.PopulateInCollection(Base.ExcelPath, "AddNewProperty"); // Owner link Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(500); //properties option Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(1000); //AddNewProperty.Click(); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value")); Thread.Sleep(1000); IWebElement Next = Driver.driver.FindElement(By.XPath(ExcelLib.ReadData(34, "Value"))); if (Next.Enabled) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "User should not be able to add the Property without any data, the test failed"); Thread.Sleep(1000); } else { Base.test.Log(LogStatus.Pass, "Unable to add the property as the valid details are not entered, the test passed"); } } catch (Exception e) { Base.test.Log(LogStatus.Error, e.Message + "Error : "); } }
internal void LARverify() { try { //Verify user is navigated back to Rental Listings and Tenant Applications page after listing the property for Rent string strproptxt = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(18, "Locator"), ExcelLib.ReadData(18, "Value")); Console.WriteLine(strproptxt); if (strproptxt == "Rental Listings and Tenant Applications") { // Base.test.Log(LogStatus.Pass, Details: " User is able to navigate to Rental Listing and Tenant Applications Page after listing a Property for Rent"); Console.WriteLine("Navigation Pass - Rental Listng and Tenant Applications Page"); } //Enter Search Text Driver.ActionButton(Driver.driver, ExcelLib.ReadData(19, "Locator"), ExcelLib.ReadData(19, "Value"), ExcelLib.ReadData(2, "Title")); Driver.wait(2); //Click on Search button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(20, "Locator"), ExcelLib.ReadData(20, "Value")); Driver.wait(2); // Base.test.Log(LogStatus.Pass, Details: " Verified that User has listed the property for Rent"); } catch (Exception e) { Base.test.Log(LogStatus.Fail, "Property is not listed for Rent", e); } }
public void Adminpage() { ExcelLib.PopulateInCollection(Base.ExcelPath, "Admin"); //Verifying admin page //clicking on admin tab Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(1000); string adminpage = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); //string adminpage = Driver.driver.FindElement(By.XPath("html/body/div[1]/div/div[2]/h3")).Text; string admin = "Admin"; Thread.Sleep(2000); try { if (adminpage == admin) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Admin page loaded"); } } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Admin page not loaded" + e.Message); } }
// Watchlist public void TenantWatchlist() { try { ExcelLib.PopulateInCollection(Base.ExcelPath, "Tenant-Watchlist"); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(500); // My Rental watchlist link Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(500); //searching Property Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(RowCountBase, "Search Property")); Thread.Sleep(500); //Click search button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value")); Thread.Sleep(500); //If property search returns no results popup occurs and test failed if (Driver.ElementVisible(Driver.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value")) == true) { Base.test.Log(LogStatus.Fail, "Search for Property found no results"); } try { IList proplistt = Driver.driver.FindElements(By.XPath(ExcelLib.ReadData(7, "Value"))); int listcountS = proplistt.Count; for (int i = 1; i <= listcountS; i++) { if (ExcelLib.ReadData(2, "Search Property") == Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value"))) { SaveScreenShotClass.SaveScreenshot(Driver.driver, "Searched Property is found"); Thread.Sleep(2000); //Log Info Base.test.Log(LogStatus.Pass, "Searched Property found and verified"); Thread.Sleep(2000); break; } else { Base.test.Log(LogStatus.Fail, "Property not found, search property test failed"); } } } catch (Exception e) { Base.test.Log(LogStatus.Info, e.Message + "There is an issue,Please check"); } } catch (Exception e) { Base.test.Log(LogStatus.Error, e.Message + "Error : "); } }
public void AddFinancialDetails() { try { //Populate in collection CommonMethods.ExcelLib.PopulateInCollection(Base.ExcelPath, "FinancialDetails"); //Enter Purchase price Driver.Textbox(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue"), ExcelLib.ReadData(2, "InputValue")); Thread.Sleep(2000); //Enter Mortgage Driver.Textbox(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue"), ExcelLib.ReadData(3, "InputValue")); Thread.Sleep(2000); //Enter Home Value Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "LocatorValue"), ExcelLib.ReadData(4, "InputValue")); Thread.Sleep(2000); //Clicking on Next button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "LocatorValue")); Thread.Sleep(2000); } catch (Exception e) { Base.test.Log(LogStatus.Error, "There is an error: " + e); Console.WriteLine("There is an error: " + e); } }
public void ValidateMandatoryFields() { //Populate in collection CommonMethods.ExcelLib.PopulateInCollection(Base.ExcelPath, "Property"); //Clicking on Owner dropdown Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue")); Thread.Sleep(2000); //clicking on properties Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue")); Thread.Sleep(2000); //clicking on Add New Property Driver.ActionButton(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "LocatorValue")); Thread.Sleep(2000); if (Driver.isDialogPresent(Driver.driver, ExcelLib.ReadData(19, "Locator"), ExcelLib.ReadData(19, "LocatorValue"))) { Console.WriteLine("Please enter your property's name."); } else { Console.WriteLine("Elements not present"); } }
internal void DeleteProperty() { ExcelLib.PopulateInCollection(Base.ExcelPath, "AddNewProperty"); // Owner link Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(500); //properties option Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(500); //searching record to delete Driver.Textbox(Driver.driver, ExcelLib.ReadData(43, "Locator"), ExcelLib.ReadData(43, "Value"), ExcelLib.ReadData(RowCountBase, "Name")); Thread.Sleep(500); //Click search button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(44, "Locator"), ExcelLib.ReadData(44, "Value")); Thread.Sleep(1000); //Select the required record to delete try { IList getrow = Driver.driver.FindElements(By.XPath(ExcelLib.ReadData(70, "Value"))); int listcount = getrow.Count; bool foundrec = true; for (int i = 1; i <= listcount && foundrec == true; i++) { if (ExcelLib.ReadData(RowCountBase, "Name") == Driver.driver.FindElement(By.XPath("//*[@id='property-grid']/div/div[2]/div[" + i + "]/div/div/div[2]/div[2]/div[1]/div[1]/div[1]")).Text) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Searched record found"); Thread.Sleep(1000); //Click on delete button from list Driver.driver.FindElement(By.XPath("//*[@id='property-grid']/div/div[2]/div[1]/div/div/div[1]/i")).Click(); Thread.Sleep(2000); //clicking on confirmation Driver.ActionButton(Driver.driver, ExcelLib.ReadData(85, "Locator"), ExcelLib.ReadData(85, "Value")); Thread.Sleep(2000); } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Data Not matched"); Thread.Sleep(2000); } } } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Error, e.Message + "There is an issue on delete,Please check"); Thread.Sleep(2000); } }
//Tenant Onboarding added by Buniya internal void tenantonboard() { try { ExcelLib.PopulateInCollection(Base.ExcelPath, "TenantOnboard"); //Read data from the excel sheet //Date of Birth Driver.GetClear(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Driver.Textbox(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value"), ExcelLib.ReadData(2, "Date of Birth")); Thread.Sleep(1000); //Home Phone Number Driver.Textbox(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value"), ExcelLib.ReadData(2, "HomePhoneNumber")); Thread.Sleep(3000); //Mobile Phone Number Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"), ExcelLib.ReadData(2, "MobilePhoneNumber")); Thread.Sleep(3000); //Current Address Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(2, "Current Address")); //Keys need to move up and down to select from the google search address Thread.Sleep(3000); new Actions(Driver.driver).SendKeys(OpenQA.Selenium.Keys.ArrowDown).Perform(); Thread.Sleep(2000); new Actions(Driver.driver).SendKeys(OpenQA.Selenium.Keys.Return).Perform(); Thread.Sleep(1000); //Scrolling Down IJavaScriptExecutor js = (IJavaScriptExecutor)Driver.driver; Thread.Sleep(2000); IWebElement element = Driver.driver.FindElement(By.XPath(ExcelLib.ReadData(8, "Value"))); (js).ExecuteScript("arguments[0].scrollIntoView(true);", element); Thread.Sleep(2000); //Click on choose files Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); Thread.Sleep(2000); //Upload Photo //AutoItX3 autoIT1 = new AutoItX3(); //autoIT1.WinActivate("Open"); //autoIT1.Send(ExcelLib.ReadData(2, "UploadPhoto")); //autoIT1.Send("{ENTER}"); Thread.Sleep(3000); //Click on Save Button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value")); Thread.Sleep(2000); //Report Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Tenant Onboarding completed successfully"); } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Error, "Error" + e.Message); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Tenant Onboarding Failed"); } }
public void UserRegistration() { ExcelLib.PopulateInCollection(Base.ExcelPath, "Register"); // Navigating to Login page using value from Excel Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "url")); //Enter Firstname Driver.WaitForElement(Driver.driver, By.XPath(ExcelLib.ReadData(2, "LocatorValue")), 6); Driver.GetClear(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue")); Driver.Textbox(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue"), ExcelLib.ReadData(2, "InputValue")); //Enter Lastname Driver.WaitForElement(Driver.driver, By.XPath(ExcelLib.ReadData(3, "LocatorValue")), 6); Driver.GetClear(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue")); Driver.Textbox(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue"), ExcelLib.ReadData(3, "InputValue")); //Enter Username Driver.WaitForElement(Driver.driver, By.XPath(ExcelLib.ReadData(4, "LocatorValue")), 6); Driver.GetClear(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "LocatorValue")); Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "LocatorValue"), ExcelLib.ReadData(4, "InputValue")); //Enter Password Driver.WaitForElement(Driver.driver, By.XPath(ExcelLib.ReadData(5, "LocatorValue")), 6); Driver.GetClear(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "LocatorValue")); Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "LocatorValue"), ExcelLib.ReadData(5, "InputValue")); //Click Register button Driver.WaitForElement(Driver.driver, By.XPath(ExcelLib.ReadData(6, "LocatorValue")), 6); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "LocatorValue")); Driver.WaitForElement(Driver.driver, By.XPath(ExcelLib.ReadData(7, "LocatorValue")), 6); string Actualmessage = Driver.driver.FindElement(By.XPath("//div[@class='alert alert-success']")).Text; string Expectedmsg = "Registration successful"; if (Actualmessage.ToLower() == Expectedmsg.ToLower()) { Login loginobj = new Login(); loginobj.LoginSuccessfull(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Registration successful"); SaveScreenShotClass.SaveScreenshot(Driver.driver, "Registration successful"); //Adding screenshot in extendReport SaveScreenShotClass.SaveScreenshot(Driver.driver, "Registration"); string screenShotPath = Global.CommonMethods.SaveScreenShotClass.SaveScreenshot(Driver.driver, "Register"); Base.test.Log(LogStatus.Pass, "Snapshot below: " + Base.test.AddScreenCapture(screenShotPath)); } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Registration is not successfull"); } }
public void OwnerDashboard() { //Populate in collection CommonMethods.ExcelLib.PopulateInCollection(Base.ExcelPath, "Property"); //Clicking on Owner dropdown Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue")); Thread.Sleep(2000); //clicking on properties Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue")); Thread.Sleep(2000); }
internal void fillform() { #region //ExcelLib.PopulateInCollection(Base.ExcelPath, "Page"); ExcelLib.PopulateInCollection(Base.ExcelPath, "Page"); Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "url")); // Driver.driver.Navigate().GoToUrl("https://qaautomation.co.nz/form1/"); //Sending Firstname Driver.Textbox(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value"), ExcelLib.ReadData(2, "FirstName")); //Sending LastNAme Driver.Textbox(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value"), ExcelLib.ReadData(2, "LastName")); //Sending Email Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"), ExcelLib.ReadData(2, "Email")); //Sending phone Number Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(2, "Phone")); //sending Subject Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(2, "Subject")); //sending Message Driver.Textbox(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value"), ExcelLib.ReadData(2, "Message")); //click on submit butotm Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "User can submit successfully"); #endregion // First name #region //var FirstName = Driver.driver.FindElement(By.XPath("//*[@id='hugeit_preview_textbox_15']")); //FirstName.SendKeys("Hi"); ////Lastname //var LastName = Driver.driver.FindElement(By.XPath("//*[@id='hugeit_preview_textbox_14']")); //LastName.SendKeys("Hi"); ////Email //var Email = Driver.driver.FindElement(By.XPath("//*[@id='hugeit_preview_textbox_20']")); //Email.SendKeys("*****@*****.**"); ////Phone //var Phone = Driver.driver.FindElement(By.XPath("//*[@id='hugeit_preview_textbox_19']")); //Phone.SendKeys("34343434343"); ////Subject //var subject = Driver.driver.FindElement(By.XPath("//*[@id='hugeit_preview_textbox_18']")); //subject.SendKeys("sjkafjasjf"); ////Message //var message = Driver.driver.FindElement(By.XPath("//*[@id='hugeit_preview_textbox_17']")); //message.SendKeys("ggkjsahfjhadjshfahfkjaf"); //var button = Driver.driver.FindElement(By.XPath("//*[@id='hugeit_preview_button__submit_21']")); //button.Click(); #endregion }
// String img = SaveScreenShotClass.SaveScreenshot(Driver.driver, "Report"); // String screenshot = SaveScreenShotClass.SaveScreenshot(Driver.driver, "ScreenShotPath"); internal void ListRentalPage() { //Populating data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "ListARental"); //Wait 2 seconds till alert is present Driver.wait(2); //Accepting alert. Console.WriteLine("Accept Alert"); Driver.wait(10); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(33, "Locator"), ExcelLib.ReadData(33, "Value")); try { //Navigate to List A Rental Page from Owner-Properties-List A Rental Link Driver.wait(2); //Click on Owner Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); //Click on Property Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Driver.wait(2); //Click on List A Rental Link Driver.ActionButton(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value")); Driver.wait(2); //Verify User is able to Navigate to List A Rental Page String strListRental = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value")); Console.WriteLine(strListRental); // Assert.AreEqual("List A Rental", strListRental); if (strListRental == "List A Rental") { Base.test.Log(LogStatus.Pass, Details: " User is able to navigate to Owner-Properties-List A Rental Page"); Console.WriteLine("navigation Pass- List A Rental page"); } //Select the Property Driver.ActionButton(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value")); Driver.wait(5); } catch (Exception e) { Base.test.Log(LogStatus.Fail, "User cannot navigate to Owner-Properties-List As Rental- List A Rental Page", e); } }
internal void Existing_pwd() { try { ExcelLib.PopulateInCollection(Base.ExcelPath, "ChangePassword"); //Skip Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); Thread.Sleep(1000); //Profile icon Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(1000); //Change password button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(1000); //Current Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"), ExcelLib.ReadData(3, "Current PWD")); Thread.Sleep(1000); //New Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(3, "New PWD")); Thread.Sleep(1000); //Confirm new Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(3, "Confirm new PWD")); Thread.Sleep(1000); //Change Password button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); Thread.Sleep(1000); IWebElement errortext = Driver.driver.FindElement(By.Id("NewPasswordTxt-error")); string msg = errortext.Text; Assert.AreEqual("* New Password must differ from old password.", msg); Base.test.Log(LogStatus.Pass, "Unable to change password as the new password and old password values are same, the test passed"); } catch (Exception e) { Base.test.Log(LogStatus.Fail, "Existing Password test failed"); //Screenshot SaveScreenShotClass.SaveScreenshot(Driver.driver, "Existing password test failed"); Base.extent.EndTest(Base.test); Base.test.Log(LogStatus.Info, e.Message + "There is an issue,Please check"); } }
internal void validate_pwdlength() { try { ExcelLib.PopulateInCollection(Base.ExcelPath, "ChangePassword"); //Skip Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); Thread.Sleep(1000); //Profile icon Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(1000); //Change password button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(1000); //Current Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"), ExcelLib.ReadData(5, "Current PWD")); Thread.Sleep(1000); //New Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(5, "New PWD")); Thread.Sleep(1000); //Confirm new Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(5, "Confirm new PWD")); Thread.Sleep(1000); //Change Password button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); Thread.Sleep(1000); IWebElement errortext = Driver.driver.FindElement(By.Id("ConfirmPasswordTxt-error")); string msg = errortext.Text; Assert.AreEqual("* The confirm password must be at least 7 characters.", msg); Base.test.Log(LogStatus.Pass, "Unable to change password as the password doesn't have minimum of 7 characters, the test passed"); } catch (Exception e) { Base.test.Log(LogStatus.Fail, "Validate Password length test failed"); //Screenshot SaveScreenShotClass.SaveScreenshot(Driver.driver, "validate pwd_length failed"); Base.extent.EndTest(Base.test); Base.test.Log(LogStatus.Info, e.Message + "There is an issue,Please check"); } }
internal void Confirm_pwd() { ExcelLib.PopulateInCollection(Base.ExcelPath, "ChangePassword"); //Skip Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); Thread.Sleep(1000); //Profile icon Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(1000); //Change password button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(1000); //Current Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"), ExcelLib.ReadData(4, "Current PWD")); Thread.Sleep(1000); //New Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(4, "New PWD")); Thread.Sleep(1000); //Confirm new Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(4, "Confirm new PWD")); Thread.Sleep(1000); //Change Password button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); Thread.Sleep(1000); try { IWebElement errortext = Driver.driver.FindElement(By.Id("ConfirmPasswordTxt-error")); string msg = errortext.Text; Assert.AreEqual("* The new password and confirmation password do not match.", msg); //Screenshot string screenShotPath = SaveScreenShotClass.SaveScreenshot(Driver.driver, "ScreenShotName"); Base.test.Log(LogStatus.Pass, "Unable to change the password as the new password and the confirmation password do not match, the test passed" + Base.test.AddScreenCapture(screenShotPath)); } catch (Exception e) { //Screenshot string screenShotPath = SaveScreenShotClass.SaveScreenshot(Driver.driver, "ScreenShotName"); Base.test.Log(LogStatus.Fail, "Confirmation Password test failed" + Base.test.AddScreenCapture(screenShotPath)); Base.test.Log(LogStatus.Info, e.Message + "There is an issue,Please check"); } }
internal void Validation() { ExcelLib.PopulateInCollection(Base.ExcelPath, "Page"); //check if user can navigate to page Driver.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "url")); string myrequest = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value")); if (myrequest == "Contact US Form") { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "User navigate to contact detail"); } //click on Submit button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); Thread.Sleep(1000); //check if user can see validation msg for Firstname string Firstname = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value")); if (Firstname == "Please Fill This Field") { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "user can see validation msg for Firstname"); } //check if user can see validation msg for Lastname string Lastname = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value")); if (Lastname == "Please Fill This Field") { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "user can see validation msg for Lastname"); } //check if user can see validation msg for Email string Email = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "Value")); if (Email == "Please Fill This Field") { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "user can see validation msg for Email"); } // check if user can see validation msg for message string message = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(13, "Locator"), ExcelLib.ReadData(13, "Value")); if (message == "Please Fill This Field") { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "user can see validation msg for Message"); } }
internal void POInsPage() { //Populating data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "POInspection"); //Wait 2 seconds till alert is present Driver.wait(2); //Accepting alert. Console.WriteLine("Accept Message"); Driver.wait(10); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); //Click on PO Link Thread.Sleep(1000); Driver.wait(50); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); }
internal void POSave() { try { //Select Tenant // Thread.Sleep(1000); // Driver.ActionButton(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(5, "Value")); //Select Tenant option Thread.Sleep(1000); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); //Select Request Type // Thread.Sleep(1000); // Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); //Select Request type option Thread.Sleep(1000); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "Value")); //Enter Due Date Thread.Sleep(1000); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value"), ExcelLib.ReadData(2, "DueDate")); //scroll the page down ((IJavaScriptExecutor)Driver.driver).ExecuteScript("window.scrollTo(0, document.body.scrollHeight - 50)"); //Enter Description Thread.Sleep(1000); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value"), ExcelLib.ReadData(2, "Description")); //Click on Save button Thread.Sleep(1000); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(14, "Locator"), ExcelLib.ReadData(14, "Value")); Console.WriteLine("Entered Inspection Request Details and Saved"); } catch (Exception e) { Console.WriteLine("Cannot Save Inspection Request Details"); } }
internal void ApplyJob() { // Populating the data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "Marketplace"); try { //Navigate to Market place Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue")); Thread.Sleep(2000); //Search Job //*...................................// //Searching data and click apply button-- pagination var i = 2; while (true) { for (int j = 1; j < 10; j++) { var Title = Driver.driver.FindElement(By.XPath("//*[@id='mainPage']/div[4]/div[3]/div[2]/a")).Text; if (Title == "this is title 7") { Console.WriteLine("title" + Title); var action = Driver.driver.FindElement(By.XPath("//*[@id='mainPage']/div[4]/div[8]/div[3]/div/div/button")); action.Click(); return; } } Driver.driver.FindElement(By.XPath("//div[@class='pagedList text-center']//li[@class='PagedList-skipToNext']/a")).Click(); i++; //*..........................// } } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, e.Message); } }
internal void LARInvalid() { ListRentalPage(); try { //Enter 1 char for property title Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value"), ExcelLib.ReadData(3, "Title")); Driver.wait(2); //Verify error message for Property Title less than 10 characters String prpmsg = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(29, "Locator"), ExcelLib.ReadData(29, "Value")); Assert.IsTrue(prpmsg.Contains("Title must consist at least 10 characters"), prpmsg + "Title has valid data"); Base.test.Log(LogStatus.Pass, Details: "User cannot add less than 10 characters for Property Title"); //Blank Property Title Driver.GetClear(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); Driver.wait(2); //Verify error message for Blank Property Title String prpblkmsg = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(30, "Locator"), ExcelLib.ReadData(30, "Value")); Assert.IsTrue(prpblkmsg.Contains("Please enter title."), prpblkmsg + "User has entered data"); Console.WriteLine("System cannot accept Blank Property Title"); Base.test.Log(LogStatus.Pass, Details: "User cannot leave Property Title field Blank"); // string screenShot= Base.test.Log(LogStatus.Pass, Base.test.AddScreenCapture(SaveScreenShot)); Base.test.Log(LogStatus.Pass, Details: "User cannot save invalid or blank mandatory field on List A Rental Page"); } catch (Exception e) { Base.test.Log(LogStatus.Fail, "User cannot Save - Property is not listed for Rent", e); } }
internal void POAddInsp() { try { //Navigate to PO Inspection Page Thread.Sleep(1000); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value")); Driver.wait(50); Console.WriteLine("Navigated to Owner Inspection page"); Thread.Sleep(1000); //Click on Add Inspection Request Link // Thread.Sleep(1000); // Driver.ActionButton(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value")); // Console.WriteLine("Navigated to Add Inspection Request page"); } catch (Exception e) { Console.WriteLine("Cannot navigate to Owner- Inspection Page"); } }
internal void POVerifyInsp() { //Click on Properties Owner Link Thread.Sleep(1000); Driver.wait(50); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); //Navigate to Owner My Requests Page Thread.Sleep(1000); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(17, "Locator"), ExcelLib.ReadData(17, "Value")); Driver.wait(50); Console.WriteLine("Navigated to Owner My Request page"); Thread.Sleep(1000); //Verify Inspection Request - Property existing // String prpname = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(18, "Locator"), ExcelLib.ReadData(18, "Value")); // String prpblkmsg = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(19, "Locator"), ExcelLib.ReadData(19, "Value")); // string prpblkmsg = "669 Dominion Road,"; // NUnit.Framework.Assert.IsTrue(prpblkmsg.Contains(prpname), prpblkmsg + "Property name is verified"); Console.WriteLine("Verified Property "); }
internal void register() { ExcelLib.PopulateInCollection(Base.ExcelPath, "Register"); //Commonsteps(); Driver.wait(2); // Email.SendKeys(ExcelLib.ReadData(2, "Email")); //Password.SendKeys(ExcelLib.ReadData(2, "Password")); //ConfirmPassword.SendKeys(ExcelLib.ReadData(2, "ConfirmPassword")); //First Name Driver.Textbox(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value"), ExcelLib.ReadData(2, "FirstName")); Driver.wait(2); //Last Name Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"), ExcelLib.ReadData(2, "LastName")); Driver.wait(2); //Email Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(2, "Email")); Driver.wait(2); //Password Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(2, "Password")); Driver.wait(2); //role Driver.ActionButton(Driver.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value")); IWebElement role = Driver.driver.FindElement(By.XPath(ExcelLib.ReadData(11, "Value"))); new SelectElement(role).SelectByText(ExcelLib.ReadData(2, "Role")); //terms of usage Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); //Resgiter button // Registerbutton.Click(); //Driver.ActionButton(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "Value")); }
internal void ListaRentalPage() { // Test to Navigate to List A Rental Page from Owner-Properties-List As Rental //Populating data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "ListARental"); try { Driver.wait(2); //Click on Owner Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); //Click on Property Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Driver.wait(2); //Click on ListAsRental link on the property which you want to list as Rental Driver.ActionButton(Driver.driver, ExcelLib.ReadData(24, "Locator"), ExcelLib.ReadData(24, "Value")); Driver.wait(2); String strListRental = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value")); Console.WriteLine(strListRental); // Assert.AreEqual("List A Rental", strListRental); if (strListRental == "List A Rental") { Base.test.Log(LogStatus.Pass, Details: " User is able to navigate to Owner-Properties-List As Rental - List A Rental Page"); Console.WriteLine("navigation Pass- List A Rental page loaded from List As a Rental - PO"); } } catch (Exception e) { Base.test.Log(LogStatus.Fail, "User cannot navigate to Owner-Properties-List As Rental- List A Rental Page", e); } }
internal void NListingPage() { //Test to Navigate to List A Rental Page from PO Dashboard- Add New Listing //Populating data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "ListARental"); try { //Click on Dashboard Driver.ActionButton(Driver.driver, ExcelLib.ReadData(26, "Locator"), ExcelLib.ReadData(26, "Value")); Driver.wait(5); Base.test.Log(LogStatus.Pass, Details: " User has clicked Dashboard - New Listing"); Console.WriteLine("User has clicked Dashboard- New Listing"); //Verify User is able to Navigate to List A Rental Page String strListRental = Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value")); Console.WriteLine(strListRental); // Assert.AreEqual("List A Rental", strListRental); if (strListRental == "List A Rental") { Base.test.Log(LogStatus.Pass, Details: " User is able to navigate to Dashboard - New Listing - List A Rental Page"); Console.WriteLine("navigation Pass- List A Rental page"); } //Select the Property Driver.ActionButton(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value")); Driver.wait(5); } catch (Exception e) { Base.test.Log(LogStatus.Fail, "User cannot navigate to Owner-Properties-List As Rental- List A Rental Page", e); } }
public void DeleteProperty() { //Populate in collection CommonMethods.ExcelLib.PopulateInCollection(Base.ExcelPath, "Property"); //Scroll a page up //IJavaScriptExecutor js = (IJavaScriptExecutor)Driver.driver; //js.ExecuteScript("window.scrollTo(0, 200);"); //Clicking on Owner dropdown Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue")); Thread.Sleep(2000); //clicking on properties Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue")); Thread.Sleep(2000); //Populate in collection CommonMethods.ExcelLib.PopulateInCollection(Base.ExcelPath, "Property"); //Clicking on Owner dropdown Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue")); Thread.Sleep(2000); //clicking on properties Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue")); Thread.Sleep(2000); //Searching for data Driver.Textbox(Driver.driver, ExcelLib.ReadData(20, "Locator"), ExcelLib.ReadData(20, "LocatorValue"), ExcelLib.ReadData(20, "InputValue")); Thread.Sleep(2000); //Click on search button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(21, "Locator"), ExcelLib.ReadData(21, "LocatorValue")); Thread.Sleep(2000); }
public void Commonsteps() { // RegisterLink.Click(); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value")); }
// Advanced search public void Advancedsearch() { try { ExcelLib.PopulateInCollection(Base.ExcelPath, "Advanced search"); // Properties for rent link Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(500); //Advanced search Driver.ActionButton(Driver.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "Value")); Thread.Sleep(500); //Advanced search Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(500); //Select Region from the list IList<IWebElement> Regions = Driver.driver.FindElements(By.XPath("//*[@id='Address_Region']/option[13]")); int RegionCount = Regions.Count(); for (int i = 0; i < RegionCount; i++) { if (Regions[i].Text == "Canterbury") { Thread.Sleep(500); Regions[i].Click(); } } //Select District from the list IList<IWebElement> Districts = Driver.driver.FindElements(By.XPath("//*[@id='Address_City']/option[3]")); int Districtscount = Districts.Count(); for (int i = 0; i < Districtscount; i++) { if (Districts[i].Text == "Christchurch City") { Thread.Sleep(500); Districts[i].Click(); } } //Select Suburbs from the list IList<IWebElement> Suburbs = Driver.driver.FindElements(By.XPath("//*[@id='Address_SuburbList']/option[46]")); int Suburbscount = Suburbs.Count(); for (int i = 0; i < Suburbscount; i++) { if (Suburbs[i].Text == "Linwood") { Thread.Sleep(500); Suburbs[i].Click(); } } //Select Bedrooms from the list IList<IWebElement> Bedrooms = Driver.driver.FindElements(By.XPath("//*[@id='BedroomMin']/option[3]")); int Bedroomscount = Bedrooms.Count(); for (int i = 0; i < Bedroomscount; i++) { if (Bedrooms[i].Text == "2") { Thread.Sleep(500); Bedrooms[i].Click(); } } //Select Bedrooms from the list IList<IWebElement> Bedrooms1 = Driver.driver.FindElements(By.XPath("//*[@id='BedroomMax']/option[4]")); int Bedroomscount1 = Bedrooms1.Count(); for (int i = 0; i < Bedroomscount1; i++) { if (Bedrooms1[i].Text == "3") { Thread.Sleep(500); Bedrooms1[i].Click(); } } //Select Bathrooms from the list IList<IWebElement> Bathrooms = Driver.driver.FindElements(By.XPath("//*[@id='BathroomMin']/option[2]")); int Bathroomscount = Bathrooms.Count(); for (int i = 0; i < Bathroomscount; i++) { if (Bathrooms[i].Text == "1") { Thread.Sleep(500); Bathrooms[i].Click(); } } //Select Bathrooms from the list IList<IWebElement> Bathrooms1 = Driver.driver.FindElements(By.XPath("//*[@id='BathroomMax']/option[3]")); int Bathroomscount1 = Bathrooms1.Count(); for (int i = 0; i < Bathroomscount1; i++) { if (Bathrooms1[i].Text == "2") { Thread.Sleep(500); Bathrooms1[i].Click(); } } //Rent per week Driver.Textbox(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value"), ExcelLib.ReadData(RowCountBase, "Rentmin")); Thread.Sleep(2000); Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(RowCountBase, "Rentmax")); Thread.Sleep(2000); //proprty ID Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(RowCountBase, "PropID")); Thread.Sleep(2000); //Select Proptype from the list IList<IWebElement> Proptype = Driver.driver.FindElements(By.XPath("//*[@id='advanced-search']/fieldset[4]/div/span/div/button/span/option[2]")); int Proptypecount = Proptype.Count(); for (int i = 0; i < Proptypecount; i++) { if (Proptype[i].Text == "Affordable Housing") { Thread.Sleep(500); Proptype[i].Click(); } } //Select Landarea from the list IList<IWebElement> Landarea = Driver.driver.FindElements(By.XPath("//*[@id='LandSqmMin']/option[2]")); int Landareacount = Landarea.Count(); for (int i = 0; i < Landareacount; i++) { if (Landarea[i].Text == "400") { Thread.Sleep(500); Landarea[i].Click(); } } //Select Landarea from the list IList<IWebElement> Landarea1 = Driver.driver.FindElements(By.XPath("//*[@id='LandSqmMax']/option[4]")); int Landareacount1 = Landarea1.Count(); for (int i = 0; i < Landareacount1; i++) { if (Landarea1[i].Text == "1200") { Thread.Sleep(500); Landarea1[i].Click(); } } //Click on Search Driver.ActionButton(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value")); Thread.Sleep(2000); try { IList proplistt = Driver.driver.FindElements(By.XPath(ExcelLib.ReadData(63, "Value"))); int listcountS = proplistt.Count; for (int i = 1; i <= listcountS; i++) { if (ExcelLib.ReadData(2, "Name") == Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(61, "Locator"), ExcelLib.ReadData(61, "Value") + i + ExcelLib.ReadData(61, "Value2"))) { SaveScreenShotClass.SaveScreenshot(Driver.driver, "Searched Property is found"); Thread.Sleep(2000); //Log Info Base.test.Log(LogStatus.Pass, "Searched Property found and verified"); Thread.Sleep(2000); break; } else { Base.test.Log(LogStatus.Fail, "Property not found, search property test failed"); } } } catch (Exception e) { Base.test.Log(LogStatus.Info, e.Message + "There is an issue,Please check"); } } catch (Exception e) { Base.test.Log(LogStatus.Error, e.Message + "Error : "); } }
// Add new property public void AddnewProperty() { try { ExcelLib.PopulateInCollection(Base.ExcelPath, "AddNewProperty"); // Owner link Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "Value")); Thread.Sleep(500); //properties option Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "Value")); Thread.Sleep(1000); //AddNewProperty Driver.ActionButton(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "Value")); Thread.Sleep(1000); //Read data from excel sheet to fill the Property deatils //Property Name Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "Value"), ExcelLib.ReadData(RowCountBase, "Name")); Thread.Sleep(1000); //Description Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "Value"), ExcelLib.ReadData(RowCountBase, "Desc")); Thread.Sleep(1000); //PropertyType Driver.Textbox(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "Value"), ExcelLib.ReadData(RowCountBase, "PropertyType")); Thread.Sleep(1000); //Choose Property Type from Dropdown list IList<IWebElement> proptypelist = Driver.driver.FindElements(By.XPath("//*[@id='property-details']/div[1]/div[2]/div/div/div/ul/li")); int listcount = proptypelist.Count(); for (int i = 0; i < listcount; i++) { if (proptypelist[i].Text == "Student Housing") { proptypelist[i].Click(); } } //Search Address Driver.Textbox(Driver.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "Value"), ExcelLib.ReadData(RowCountBase, "Address")); Thread.Sleep(2000); new Actions(Driver.driver).SendKeys(OpenQA.Selenium.Keys.ArrowDown).Perform(); Thread.Sleep(2000); new Actions(Driver.driver).SendKeys(OpenQA.Selenium.Keys.Return).Perform(); Thread.Sleep(2000); //scroll down IJavaScriptExecutor jse = (IJavaScriptExecutor)Driver.driver; IWebElement element1 = Driver.driver.FindElement(By.XPath(ExcelLib.ReadData(25, "Value"))); (jse).ExecuteScript("arguments[0].scrollIntoView(true);", element1); Thread.Sleep(1000); //Select rent type from the drop down IList<IWebElement> Renttypes = Driver.driver.FindElements(By.XPath("//*[@id='property-details']/div[3]/div[3]/div/select/option")); int RentTypeCount = Renttypes.Count(); for (int i = 0; i < RentTypeCount; i++) { if (Renttypes[i].Text == "Monthly") { Thread.Sleep(2000); Renttypes[i].Click(); } } //Year Built Driver.Textbox(Driver.driver, ExcelLib.ReadData(21, "Locator"), ExcelLib.ReadData(21, "Value"), ExcelLib.ReadData(RowCountBase, "Year")); Thread.Sleep(1000); //target rent Driver.Textbox(Driver.driver, ExcelLib.ReadData(32, "Locator"), ExcelLib.ReadData(32, "Value"), ExcelLib.ReadData(RowCountBase, "TargetRent")); Thread.Sleep(1000); //Bedrooms Driver.Textbox(Driver.driver, ExcelLib.ReadData(23, "Locator"), ExcelLib.ReadData(23, "Value"), ExcelLib.ReadData(RowCountBase, "Bedroom")); Thread.Sleep(2000); //Bathrooms Driver.Textbox(Driver.driver, ExcelLib.ReadData(25, "Locator"), ExcelLib.ReadData(25, "Value"), ExcelLib.ReadData(RowCountBase, "Bathroom")); Thread.Sleep(2000); //FloorArea Driver.Textbox(Driver.driver, ExcelLib.ReadData(27, "Locator"), ExcelLib.ReadData(27, "Value"), ExcelLib.ReadData(RowCountBase, "FloorArea")); Thread.Sleep(2000); //Land Area Driver.Textbox(Driver.driver, ExcelLib.ReadData(29, "Locator"), ExcelLib.ReadData(29, "Value"), ExcelLib.ReadData(RowCountBase, "LandArea")); Thread.Sleep(2000); //Car parks Driver.Textbox(Driver.driver, ExcelLib.ReadData(31, "Locator"), ExcelLib.ReadData(31, "Value"), ExcelLib.ReadData(RowCountBase, "Carparks")); Thread.Sleep(2000); //scroll down IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver.driver; IWebElement element2 = Driver.driver.FindElement(By.XPath(ExcelLib.ReadData(34, "Value"))); (js1).ExecuteScript("arguments[0].scrollIntoView(true);", element2); //Next button not enabled dynamically - include action tab key new Actions(Driver.driver).SendKeys(OpenQA.Selenium.Keys.Tab).Perform(); Thread.Sleep(2000); //click on next Driver.ActionButton(Driver.driver, ExcelLib.ReadData(34, "Locator"), ExcelLib.ReadData(34, "Value")); Thread.Sleep(3000); } catch (Exception e) { Base.test.Log(LogStatus.Info, e.Message + "There is an issue,Please check"); } try { //Add financial data //purchase price Driver.Textbox(Driver.driver, ExcelLib.ReadData(37, "Locator"), ExcelLib.ReadData(37, "Value"), ExcelLib.ReadData(37, "Value2")); Thread.Sleep(2000); //Mortgage Driver.Textbox(Driver.driver, ExcelLib.ReadData(38, "Locator"), ExcelLib.ReadData(38, "Value"), ExcelLib.ReadData(38, "Value2")); Thread.Sleep(2000); //Home Value Driver.Textbox(Driver.driver, ExcelLib.ReadData(39, "Locator"), ExcelLib.ReadData(39, "Value"), ExcelLib.ReadData(39, "Value2")); Thread.Sleep(2000); //Select home value type from the dropdown IList<IWebElement> homevaluetypes = Driver.driver.FindElements(By.XPath("//*[@id='financeSection']/div[2]/div[2]/div/select/option")); int HomevalueTypeCount = homevaluetypes.Count(); for (int i = 0; i < HomevalueTypeCount; i++) { if (homevaluetypes[i].Text == "Estimated") { Thread.Sleep(2000); homevaluetypes[i].Click(); } } Thread.Sleep(2000); IJavaScriptExecutor js = (IJavaScriptExecutor)Driver.driver; Thread.Sleep(2000); IWebElement element = Driver.driver.FindElement(By.XPath(ExcelLib.ReadData(56, "Value"))); (js).ExecuteScript("arguments[0].scrollIntoView(true);", element); Thread.Sleep(2000); //Click on next Driver.ActionButton(Driver.driver, ExcelLib.ReadData(56, "Locator"), ExcelLib.ReadData(56, "Value")); Thread.Sleep(1000); } catch (Exception e) { Base.test.Log(LogStatus.Info, e.Message + "There is an issue,Please check"); } try { //Add tenant details //Enter tenant email Driver.Textbox(Driver.driver, ExcelLib.ReadData(50, "Locator"), ExcelLib.ReadData(50, "Value"), ExcelLib.ReadData(50, "Value2")); Thread.Sleep(2000); //Main tenant IList<IWebElement> maintenant = Driver.driver.FindElements(By.XPath("//*[@id='tenant-area']/div[1]/div[2]/div/select/option")); int mainCount = maintenant.Count(); for (int i = 0; i < mainCount; i++) { if (maintenant[i].Text == "No") { Thread.Sleep(2000); maintenant[i].Click(); } } //First Name Thread.Sleep(2000); Driver.Textbox(Driver.driver, ExcelLib.ReadData(65, "Locator"), ExcelLib.ReadData(65, "Value"), ExcelLib.ReadData(65, "Value2")); //Last Name Thread.Sleep(2000); Driver.Textbox(Driver.driver, ExcelLib.ReadData(66, "Locator"), ExcelLib.ReadData(66, "Value"), ExcelLib.ReadData(66, "Value2")); //Start Date Thread.Sleep(2000); Driver.GetClear(Driver.driver, ExcelLib.ReadData(51, "Locator"), ExcelLib.ReadData(51, "Value")); Thread.Sleep(1000); Driver.Textbox(Driver.driver, ExcelLib.ReadData(51, "Locator"), ExcelLib.ReadData(51, "Value"), ExcelLib.ReadData(51, "Value2")); //End Date Thread.Sleep(3000); Driver.GetClear(Driver.driver, ExcelLib.ReadData(52, "Locator"), ExcelLib.ReadData(52, "Value")); Thread.Sleep(1000); Driver.Textbox(Driver.driver, ExcelLib.ReadData(52, "Locator"), ExcelLib.ReadData(52, "Value"), ExcelLib.ReadData(52, "Value2")); //Payment Frequency IList<IWebElement> payfreqlist = Driver.driver.FindElements(By.XPath("//*[@id='tenantSection']/div[4]/div[2]/div/select/option")); int payfreqCount = payfreqlist.Count(); for (int i = 0; i < payfreqCount; i++) { if (payfreqlist[i].Text == "Monthly") { Thread.Sleep(2000); payfreqlist[i].Click(); } } //Enter rent amount Driver.Textbox(Driver.driver, ExcelLib.ReadData(58, "Locator"), ExcelLib.ReadData(58, "Value"), ExcelLib.ReadData(58, "Value2")); Thread.Sleep(2000); //payment start date Thread.Sleep(3000); Driver.GetClear(Driver.driver, ExcelLib.ReadData(67, "Locator"), ExcelLib.ReadData(67, "Value")); Thread.Sleep(1000); Driver.Textbox(Driver.driver, ExcelLib.ReadData(67, "Locator"), ExcelLib.ReadData(67, "Value"), ExcelLib.ReadData(67, "Value2")); //payment due date Thread.Sleep(1000); IList<IWebElement> payduelist = Driver.driver.FindElements(By.XPath("//*[@id='tenantSection']/div[5]/div[2]/div/select/option")); int paydueCount = payduelist.Count(); for (int i = 0; i < paydueCount; i++) { if (payduelist[i].Text == "1") { payduelist[i].Click(); } } Thread.Sleep(2000); IWebElement save = Driver.driver.FindElement(By.XPath(ExcelLib.ReadData(54, "Value"))); if (save.Enabled) { Driver.ActionButton(Driver.driver, ExcelLib.ReadData(54, "Locator"), ExcelLib.ReadData(54, "Value")); Thread.Sleep(1000); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Mandatory fields entered, Clicked on save button to add a new property"); Thread.Sleep(1000); //Check if unregistered tenant alert on screen, if so accept if (Driver.isDialogPresent(Driver.driver)) { Driver.driver.SwitchTo().Alert().Accept(); } Thread.Sleep(1000); Base.test.Log(LogStatus.Info, "Record added sucessfully"); Thread.Sleep(3000); //verify added record and navigate through pages to find the record Driver.Textbox(Driver.driver, ExcelLib.ReadData(43, "Locator"), ExcelLib.ReadData(43, "Value"), ExcelLib.ReadData(RowCountBase, "Name")); Thread.Sleep(2000); //SearchButton.Click(); Driver.ActionButton(Driver.driver, ExcelLib.ReadData(44, "Locator"), ExcelLib.ReadData(44, "Value")); Thread.Sleep(2000); //If property search returns no results popup occurs and test failed if (Driver.ElementVisible(Driver.driver, ExcelLib.ReadData(64, "Locator"), ExcelLib.ReadData(64, "Value")) == true) { Base.test.Log(LogStatus.Fail, "Search for Property found no results, add property test failed"); } /* //get row count using Ilist IList proplistt = Driver.driver.FindElements(By.XPath(ExcelLib.ReadData(63, "Value"))); int listcountS = proplistt.Count; for (int i = 1; i <= listcountS; i++) { if (ExcelLib.ReadData(2, "Name") == Driver.GetTextValue(Driver.driver, ExcelLib.ReadData(61, "Locator"), ExcelLib.ReadData(61, "Value") + i + ExcelLib.ReadData(61, "Value2"))) {*/ IWebElement Name = Driver.driver.FindElement(By.XPath("//*[@id='mainPage']/div[4]/div[1]/div/div/div[2]/div[2]/div[1]/div[1]/div[1]")); string confirmName = Name.Text; Assert.AreEqual("Spencors villa", confirmName); IWebElement Address = Driver.driver.FindElement(By.XPath("//*[@id='mainPage']/div[4]/div[1]/div/div/div[2]/div[2]/div[1]/div[1]/div[2]/span[1]")); string confirmAddress = Address.Text; Assert.AreEqual("411 Gloucester Street,", confirmAddress); IWebElement Address1 = Driver.driver.FindElement(By.XPath("//*[@id='mainPage']/div[4]/div[1]/div/div/div[2]/div[2]/div[1]/div[1]/div[2]/span[2]")); string confirmAddress1 = Address1.Text; Assert.AreEqual("Linwood, Christchurch", confirmAddress1); IWebElement PurchasePrice = Driver.driver.FindElement(By.XPath("//*[@id='mainPage']/div[4]/div[1]/div/div/div[2]/div[2]/div[1]/div[2]/div[1]/span")); string confirmPrice = PurchasePrice.Text; Assert.AreEqual("1,200,000.00", confirmPrice); IWebElement Homevalue = Driver.driver.FindElement(By.XPath("//*[@id='mainPage']/div[4]/div[1]/div/div/div[2]/div[2]/div[1]/div[2]/div[2]/span")); string confirmHomevalue = Homevalue.Text; Assert.AreEqual("1,500,000.00", confirmHomevalue); SaveScreenShotClass.SaveScreenshot(Driver.driver, "Found Added Property"); Thread.Sleep(2000); //Log Info Base.test.Log(LogStatus.Pass, "Added Property found and verified"); Thread.Sleep(2000); /* break; } else { Base.test.Log(LogStatus.Fail, "Property not found, add property test failed"); } }*/ } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Submit button is disabled. Please check your data"); } } catch (Exception e) { Base.test.Log(LogStatus.Error, e.Message + "Error : "); }
public void AddProperty() { try { //Populate in collection CommonMethods.ExcelLib.PopulateInCollection(Base.ExcelPath, "Property"); //Scroll a page up //IJavaScriptExecutor js = (IJavaScriptExecutor)Driver.driver; //js.ExecuteScript("window.scrollTo(0, 200);"); //Clicking on Owner dropdown Driver.ActionButton(Driver.driver, ExcelLib.ReadData(2, "Locator"), ExcelLib.ReadData(2, "LocatorValue")); Thread.Sleep(2000); //clicking on properties Driver.ActionButton(Driver.driver, ExcelLib.ReadData(3, "Locator"), ExcelLib.ReadData(3, "LocatorValue")); Thread.Sleep(2000); //clicking on Add New Property Driver.ActionButton(Driver.driver, ExcelLib.ReadData(4, "Locator"), ExcelLib.ReadData(4, "LocatorValue")); Thread.Sleep(2000); //Enter Property Name Driver.Textbox(Driver.driver, ExcelLib.ReadData(5, "Locator"), ExcelLib.ReadData(5, "LocatorValue"), ExcelLib.ReadData(5, "InputValue")); Thread.Sleep(2000); //Enter Description Driver.Textbox(Driver.driver, ExcelLib.ReadData(6, "Locator"), ExcelLib.ReadData(6, "LocatorValue"), ExcelLib.ReadData(6, "InputValue")); Thread.Sleep(2000); //Scroll a page down //IJavaScriptExecutor js = (IJavaScriptExecutor)Driver.driver; //js.ExecuteScript("window.scrollTo(0, 200);"); //Enter Number Driver.Textbox(Driver.driver, ExcelLib.ReadData(7, "Locator"), ExcelLib.ReadData(7, "LocatorValue"), ExcelLib.ReadData(7, "InputValue")); Thread.Sleep(2000); //Enter Street Driver.Textbox(Driver.driver, ExcelLib.ReadData(8, "Locator"), ExcelLib.ReadData(8, "LocatorValue"), ExcelLib.ReadData(8, "InputValue")); Thread.Sleep(2000); //Enter city Driver.Textbox(Driver.driver, ExcelLib.ReadData(9, "Locator"), ExcelLib.ReadData(9, "LocatorValue"), ExcelLib.ReadData(9, "InputValue")); Thread.Sleep(2000); //Enter Postcode Driver.Textbox(Driver.driver, ExcelLib.ReadData(10, "Locator"), ExcelLib.ReadData(10, "LocatorValue"), ExcelLib.ReadData(10, "InputValue")); Thread.Sleep(2000); //Scroll a page down IJavaScriptExecutor js1 = (IJavaScriptExecutor)Driver.driver; js1.ExecuteScript("window.scrollTo(0, 200);"); //Enter Region Driver.Textbox(Driver.driver, ExcelLib.ReadData(11, "Locator"), ExcelLib.ReadData(11, "LocatorValue"), ExcelLib.ReadData(11, "InputValue")); Thread.Sleep(2000); //Enter Year Built Driver.Textbox(Driver.driver, ExcelLib.ReadData(12, "Locator"), ExcelLib.ReadData(12, "LocatorValue"), ExcelLib.ReadData(12, "InputValue")); Thread.Sleep(2000); //Scroll a page down IJavaScriptExecutor js = (IJavaScriptExecutor)Driver.driver; js1.ExecuteScript("window.scrollTo(0, 200);"); //Enter Target rent Driver.Textbox(Driver.driver, ExcelLib.ReadData(13, "Locator"), ExcelLib.ReadData(13, "LocatorValue"), ExcelLib.ReadData(13, "InputValue")); Thread.Sleep(2000); //Enter Bedroom Driver.Textbox(Driver.driver, ExcelLib.ReadData(14, "Locator"), ExcelLib.ReadData(14, "LocatorValue"), ExcelLib.ReadData(14, "InputValue")); Thread.Sleep(2000); //Enter Bathroom Driver.Textbox(Driver.driver, ExcelLib.ReadData(15, "Locator"), ExcelLib.ReadData(15, "LocatorValue"), ExcelLib.ReadData(15, "InputValue")); Thread.Sleep(2000); //Enter Carpark Driver.Textbox(Driver.driver, ExcelLib.ReadData(16, "Locator"), ExcelLib.ReadData(16, "LocatorValue"), ExcelLib.ReadData(16, "InputValue")); Thread.Sleep(2000); //Scroll a page down //IJavaScriptExecutor js2 = (IJavaScriptExecutor)Driver.driver; //js2.ExecuteScript("window.scrollTo(0, 50);"); //Clicking on Next button Driver.ActionButton(Driver.driver, ExcelLib.ReadData(17, "Locator"), ExcelLib.ReadData(17, "LocatorValue")); Thread.Sleep(2000); //Adding Financial details AddFinancialDetails(); //Add Tenant details AddTenantDetails(); //Screenshot SaveScreenShotClass.SaveScreenshot(Driver.driver, "Tenant and property"); //Report Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Property and tenant added sucessfully"); //Checking successful message //var ExpectedRes = "Property created successfully"; //var ActualRes = } catch (Exception e) { Base.test.Log(LogStatus.Error, "There is an error: " + e); Console.WriteLine("There is an error: " + e); } }