// Edit a property by searching address internal void EditAPropertyBySearchAddress() { try { //Edit name textbox PropertyName.Clear(); Thread.Sleep(1000); PropertyName.SendKeys("BHouse"); //SearchAddress SearchAddress.SendKeys("77"); Thread.Sleep(1000); SearchAddress.SendKeys(Keys.ArrowDown); SearchAddress.SendKeys(Keys.Enter); Thread.Sleep(1000); //Edit description textbox Description.Clear(); Thread.Sleep(1000); Description.SendKeys("Beautiful House"); //Click on the "Save" button SaveButton.Click(); Thread.Sleep(2000); } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Edit Unsuccessfull", e.Message); } }
//Edit a property by uploading a picture internal void EditAPropertyByUploadPicture() { try { //Edit name textbox PropertyName.Clear(); Thread.Sleep(1000); PropertyName.SendKeys("Lovely house for you"); //upload a picture IWebElement upload = Driver.driver.FindElement(By.XPath("//*[@id='fileUpload']")); upload.SendKeys(@"C:\TestData\home.jpg"); 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, Edit Unsuccessfull", e.Message); } }
internal void GetDataFromExcel() { try { // Populating the data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "PropertyDetails"); //Edit name textbox PropertyName.Clear(); Thread.Sleep(1000); PropertyName.SendKeys(ExcelLib.ReadData(2, "Property Name")); //Edit description textbox Description.Clear(); Thread.Sleep(1000); Description.SendKeys(ExcelLib.ReadData(2, "Description")); //Edit Number textbox StreetNumber.Clear(); Thread.Sleep(1000); StreetNumber.SendKeys(ExcelLib.ReadData(2, "Number")); //Edit Street textbox Street.Clear(); Thread.Sleep(1000); Street.SendKeys(ExcelLib.ReadData(2, "Street")); //Edit Suburb textbox // Suburb.Clear(); // Thread.Sleep(1000); // Suburb.SendKeys(ExcelLib.ReadData(2, "Suburb")); //Edit City textbox City.Clear(); Thread.Sleep(1000); City.SendKeys(ExcelLib.ReadData(2, "City")); //Edit Postcode textbox Postcode.Clear(); Thread.Sleep(1000); Postcode.SendKeys(ExcelLib.ReadData(2, "Postcode")); //Edit Region textbox Region.Clear(); Thread.Sleep(1000); Region.SendKeys(ExcelLib.ReadData(2, "Region")); //Select Year in Year Built YearBuilt.SendKeys(ExcelLib.ReadData(2, "YearBuilt")); Thread.Sleep(1000); //Edit Target Rent textbox TargetRent.Clear(); Thread.Sleep(1000); TargetRent.SendKeys(ExcelLib.ReadData(2, "Target Rent")); //Edit Bed rooms textbox Bedrooms.Clear(); Thread.Sleep(1000); Bedrooms.SendKeys(ExcelLib.ReadData(2, "Bedrooms")); //Edit Bath rooms textbox Bathrooms.Clear(); Thread.Sleep(1000); Bathrooms.SendKeys(ExcelLib.ReadData(2, "Bathrooms")); //Edit Carparks textbox Carparks.Clear(); Thread.Sleep(1000); Carparks.SendKeys(ExcelLib.ReadData(2, "Carparks")); Carparks.SendKeys(Keys.Enter); Thread.Sleep(1000); //Click on the "Next" button NextButton.Click(); Thread.Sleep(2000); } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Add Property Details Unsuccessfull", e.Message); } }
//Edit a property from Excel data internal void EditAPropertyFromExcelData() { try { // Populating the data from Excel ExcelLib.PopulateInCollection(Base.ExcelPath, "PropertyDetails"); //Edit name textbox PropertyName.Clear(); Thread.Sleep(1000); PropertyName.SendKeys(ExcelLib.ReadData(2, "Property Name")); //Edit description textbox Description.Clear(); Thread.Sleep(1000); Description.SendKeys(ExcelLib.ReadData(2, "Description")); //Edit Number textbox StreetNumber.Clear(); Thread.Sleep(1000); StreetNumber.SendKeys(ExcelLib.ReadData(2, "Number")); //Edit Street textbox Street.Clear(); Thread.Sleep(1000); Street.SendKeys(ExcelLib.ReadData(2, "Street")); //Edit Suburb textbox Suburb.Clear(); Thread.Sleep(1000); Suburb.SendKeys(ExcelLib.ReadData(2, "Suburb")); //Edit City textbox City.Clear(); Thread.Sleep(1000); City.SendKeys(ExcelLib.ReadData(2, "City")); //Edit Postcode textbox Postcode.Clear(); Thread.Sleep(1000); Postcode.SendKeys(ExcelLib.ReadData(2, "Postcode")); //Edit Region textbox Region.Clear(); Thread.Sleep(1000); Region.SendKeys(ExcelLib.ReadData(2, "Region")); //Select Year in Year Built YearBuilt.Click(); Thread.Sleep(1000); var selectElement = new SelectElement(YearBuilt); //select by text string sYear = ExcelLib.ReadData(2, "YearBuilt"); //Debug.Assert(sYear == "1977"); selectElement.SelectByText(sYear); Thread.Sleep(1000); //Edit Target Rent textbox TargetRent.Clear(); Thread.Sleep(1000); TargetRent.SendKeys(ExcelLib.ReadData(2, "Target Rent")); //Edit Bed rooms textbox Bedrooms.Clear(); Thread.Sleep(1000); Bedrooms.SendKeys(ExcelLib.ReadData(2, "Bedrooms")); //Edit Bath rooms textbox Bathrooms.Clear(); Thread.Sleep(1000); Bathrooms.SendKeys(ExcelLib.ReadData(2, "Bathrooms")); //Edit Carparks textbox Carparks.Clear(); Thread.Sleep(1000); Carparks.SendKeys(ExcelLib.ReadData(2, "Carparks")); //Click on the "Save" button SaveButton.Click(); Thread.Sleep(2000); } catch (Exception e) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Edit Unsuccessfull", e.Message); } }