// [Test] public void TC25_SIT_Library_ConsumerPackaging() { try { GeneralMethods sGMethods = new GeneralMethods(); Thread.Sleep(10000); xCellFileHelper = new ExcelHelper(datafilePath, 1); string username = xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "PDQAUSER"); //"admtempjavas"; string password = xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "PDQAPWD"); //"admtempjavas"; string season = xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "Season"); // "7-2018"; string office = "CNSH"; Thread.Sleep(1000); driver.Manage().Window.Maximize(); Thread.Sleep(1000); driver.Navigate().GoToUrl(ConfigUtils.Read("URL_Castor")); Thread.Sleep(4000); try { sGMethods.AlertAccept(driver); } catch { } List <string> lswins = driver.WindowHandles.ToList(); sGMethods.GetLatestWindow(driver); Castorpages castorobjs = new Castorpages(driver); //castorobjs.CastorLogin( //xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "librarianUser"), //xCellFileHelper.GetCellValueByRowAndColumn("Selenium_SmokeTest1", "librarianPassword")); castorobjs.CastorLogin(username, password); Reporter.ReportEvent("Login to Application with user : "******"Login Pass", HP.LFT.Report.Status.Passed); Thread.Sleep(20000); // ********************************************Consumer Packaging***************************************************************************** libraryUi.LaunchConsumerPackaging(); Reporter.ReportEvent("Launch Consumer Packaging", "Launch Consumer Packaging Pass", HP.LFT.Report.Status.Passed); libraryUi.traverseContentFrame(); libraryUi.traverseToContentBodyFrameTableSettings(); libraryUi.get_ActionLinkForDropDown().Click(); libraryUi.get_CreateConsumerPackagingForDropDown().Click(); Reporter.ReportEvent("Create new Consumer Packaging", "Create new Consumer Packaging Pass", HP.LFT.Report.Status.Passed); string libraryWindow = libraryUi.get_libraryWindow(); libraryUi.get_NewLaunchedWindow(); if (libraryUi.get_CreateConsumerPackagingText().Displayed) { System.Diagnostics.Debug.WriteLine("******* PASS"); } driver.SwitchTo().Frame("pagecontent"); if (libraryUi.get_showTypeSelector().Displayed) { Thread.Sleep(3000); } libraryUi.get_showTypeSelector().Click(); string type = libraryUi.get_libraryWindow(); libraryUi.get_NewLaunchedWindow(); libraryUi.get_PackagingExpand().Click(); Thread.Sleep(2000); libraryUi.get_BoxRadioButton().Click(); libraryUi.get_SelectButton().Click(); Reporter.ReportEvent("Create new Consumer Packaging in new popup", "Create new Consumer Packaging in new popup Pass", HP.LFT.Report.Status.Passed); driver.SwitchTo().Window(type); driver.SwitchTo().Frame("pagecontent"); libraryUi.get_txtDescription().Click(); libraryUi.get_txtDescription().SendKeys("Automation Test"); libraryUi.get_Concept().Click(); libraryUi.selectSeason(season); driver.SwitchTo().DefaultContent(); libraryUi.get_DoneButton().Click(); driver.SwitchTo().Window(libraryWindow); Thread.Sleep(4000); libraryUi.traverseContentFrame(); driver.SwitchTo().Frame("detailsDisplay"); libraryUi.get_EditButton().Click(); Reporter.ReportEvent("Edit created Consumer Packaging", "Edit created Consumer Packaging Pass", HP.LFT.Report.Status.Passed); libraryUi.get_btnSupplier().Click(); Thread.Sleep(5000); libraryWindow = libraryUi.get_libraryWindow(); libraryUi.get_NewLaunchedWindow(); Thread.Sleep(15000); driver.SwitchTo().DefaultContent(); driver.SwitchTo().Frame("searchPane"); sGMethods.SelectDropDownByValue(libraryUi.get_OfficeIdDropDown(), office); driver.SwitchTo().DefaultContent(); libraryUi.get_FindButton().Click(); Thread.Sleep(10000); IAlert alert = driver.SwitchTo().Alert(); alert.Accept(); driver.SwitchTo().Frame("listDisplay"); Thread.Sleep(5000); libraryUi.get_btnSupplierCheckBox().Click(); Thread.Sleep(5000); driver.SwitchTo().DefaultContent(); libraryUi.get_SubmitButton().Click(); Reporter.ReportEvent("Selected supplier for new Consumer Packaging", "Selected supplier for new Consumer Packaging Pass", HP.LFT.Report.Status.Passed); driver.SwitchTo().Window(libraryWindow); System.Diagnostics.Debug.WriteLine(driver.Title); Thread.Sleep(4000); libraryUi.traverseContentFrame(); driver.SwitchTo().Frame("detailsDisplay"); if (libraryUi.get_DoneButtonCastor().Displayed) { Thread.Sleep(3000); } libraryUi.get_DoneButtonCastor().Click(); libraryUi.get_Initiatedlink().Click(); libraryWindow = libraryUi.get_libraryWindow(); libraryUi.get_NewLaunchedWindow(); driver.SwitchTo().DefaultContent(); driver.SwitchTo().Frame("pagecontent"); if (libraryUi.get_stateNameHighlight("Initiated").Displayed) { System.Diagnostics.Debug.WriteLine("::::::::::::::::::::: PASS"); } Reporter.ReportEvent("Status is Initiated", "Status is Initiated Pass", HP.LFT.Report.Status.Passed); driver.SwitchTo().DefaultContent(); libraryUi.get_StatePromote().Click(); Thread.Sleep(3000); driver.SwitchTo().Frame("pagecontent"); if (libraryUi.get_stateNameHighlight("Review").Displayed) { System.Diagnostics.Debug.WriteLine("::::::::::::::::::::: PASS"); } Reporter.ReportEvent("Status is Review", "Status is Review Pass", HP.LFT.Report.Status.Passed); driver.SwitchTo().DefaultContent(); libraryUi.get_StatePromote().Click(); Thread.Sleep(3000); driver.SwitchTo().Frame("pagecontent"); if (libraryUi.get_stateNameHighlight("Released").Displayed) { System.Diagnostics.Debug.WriteLine("::::::::::::::::::::: PASS"); } Reporter.ReportEvent("Status is Released", "Status is Released Pass", HP.LFT.Report.Status.Passed); driver.Close(); driver.SwitchTo().Window(libraryWindow); iccPortal.LaunchICCWindow(); iccPortal.SelectValueFromApplicationDropDown("ConsumerPackaging_Castor"); iccPortal.VerifySearchResult("ConsumerPackaging"); iccPortal.VerifyPortInSearchResult("ConsumerPackaging.Shredder"); Reporter.ReportEvent("ICC portal 'ConsumerPackaging_Castor' Processed for Shredder", "ICC portal 'ConsumerPackaging_Castor' Processed for Shredder", HP.LFT.Report.Status.Passed); } catch (Exception ex) { string stimestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss").ToString(); string ESSpath = System.Environment.GetEnvironmentVariable("ProjectWorkingDirectory") + "ImagesPath\\" + stimestamp + ".Png"; Screenshot sc = ((ITakesScreenshot)driver).GetScreenshot(); sc.SaveAsFile(ESSpath, ImageFormat.Png); System.Diagnostics.Debug.WriteLine("Message*********************" + ex.Message); System.Diagnostics.Debug.WriteLine("StackTrace*********************" + ex.StackTrace); Reporter.ReportEvent("TC25_SIT_Library_ConsumerPackaging script fail", "TC25_SIT_Library_ConsumerPackaging Script fail" + ex.Message, HP.LFT.Report.Status.Failed, ESSpath); } }