internal void AddNewRequest() { try { ExcelLib.PopulateInCollection(Base.ExcelPath, "TenantMyRequest"); //IWebElement MyReqPage = Driver.driver.FindElement(By.XPath(".//*[@id='RequestPage']/div[1]/div/h3")); //Validate navigation to "Rental Request Form" page bool bPage = Driver.driver.PageSource.Contains("RequestPage"); if (bPage) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Navigated to Rental Request Form"); } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Page details not verified"); } //Select 3rd option from the Drop down list IWebElement SelectPropertyDDL = Driver.driver.FindElement(By.XPath("html/body/div/section/div/div[2]/form/fieldset/div[1]/div/div/select")); var selectElement = new SelectElement(SelectPropertyDDL); selectElement.SelectByIndex(2); //Validate Property Detail is reflecting the selction of Property string PropertyDetail = Driver.driver.FindElement(By.XPath("html/body/div/section/div/div[2]/form/fieldset/div[2]/div[2]/div[1]/div/span")).Text; bool bRet = PropertyDetail.Contains("580 Great South Road Papakura"); if (!bRet) { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Property Details doesn't match"); } //DDLSelectProp.Click(); IWebElement JobReqType = Driver.driver.FindElement(By.Id("jobRequestType")); var jSelectElement = new SelectElement(JobReqType); jSelectElement.SelectByIndex(1); //Validate if TextField under Message is visible and fill the data from excel sheet bool bEnable = TxtMessage.Enabled; if (bEnable) { TxtMessage.SendKeys(ExcelLib.ReadData(2, "Message")); Driver.wait(3); BtnSubmit.Click(); //verify the PopMessage text //string AlertMsg = Driver.driver.SwitchTo().Alert().Text; //if (AlertMsg == "Item added successful") //{ // Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "New request submitted"); //} //else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, AlertMsg); } } else { Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Message box not enabled"); } } catch (Exception ex) { string exceptionMessage = ex.Message; } }