/// <summary> /// MayurP on 10/08/2017 /// Function to validate Data Access saved record from Manage Data Access /// </summary> /// <param name="sourceName"> string Source Name </param> /// <param name="objDataAccessPage"> Data Access Page Object</param> /// <param name="objManageDataAccess">Manage Data Access Page Object</param> /// <returns> true if Data is present in Data Access Table ,false if Data is not present in the same</returns> public bool ValidateSavedDataAccess(string sourceName, LP.ProductModel.DataAccessPage objDataAccessPage, LP.ProductModel.ManageDataAccess objManageDataAccess) { try { bool resultFlag = false; int colIndex = WebTableHelper.GetColumnIndex(objDataAccessPage.tblDataAccessRecords, "Source Name"); int rowIndex = WebTableHelper.GetRowIndexFromTable(WebTableHelper.GetAllRowsFromTable(objDataAccessPage.tblDataAccessRecords), sourceName, colIndex); if (colIndex != -1 && rowIndex != -1) { string cellValue = WebTableHelper.GetCellFromTable(objDataAccessPage.tblDataAccessRecords, rowIndex - 1, colIndex); if (cellValue == sourceName) { resultFlag = true; } } else { resultFlag = false; } return(resultFlag); } catch (Exception ex) { LodgementPortalApp.log.LogInfo(false, ex.Message); return(false); } }
/// <summary> /// Author : Kavita Nunse /// Desc : Sets different status on search lodgement page /// </summary> /// <param name="statusList"></param> /// <returns></returns> public bool SelectDifferentLodgeStatus(params string[] statusList) { try { bool flag = true; for (int i = 0; i < statusList.Length; i++) { // Click on Search Magnifying Icon present on My Lodgement tab if (SearchMagnifyingIcon.FindElement(By.XPath("..")).GetAttribute("class").Contains("collapsed")) { Retry.Do(SearchMagnifyingIcon.Click); } HelperLibrary.SelectItem(LodgementPortalApp.SearchLodgementPage.status, statusList[i]); // Click on search button SearchButton.Click(); // Get Column data int columnIndex = WebTableHelper.GetColumnIndex(searchGrid, LodgementPortalConstants.STATUS); string columnValue = WebTableHelper.GetCellFromTable(searchGrid, 0, columnIndex); if (columnValue.Contains(statusList[i])) { HelperLibrary.log.LogInfo(true, string.Format("Successfully Searched Record Status with value {0} in My Lodgement tab", statusList[i])); } else if (NoRecordFound.Displayed) { HelperLibrary.log.LogInfo(false, string.Format("Failed to Search Record Status with value {0} in My Lodgement tab", statusList[i])); flag = false; } } return(flag); } catch (Exception ex) { HelperLibrary.log.LogException(ex, ex.StackTrace); return(false); } }
/// <summary> /// Kavita Nunse <3-Aug-2017> /// Desc: Search Single values /// </summary> /// <param name="searchFields"></param> /// <returns></returns> public bool searchLodgements(Dictionary <IWebElement, string> searchFields, Dictionary <IWebElement, string> searchColumn) { bool flag = true; bool findSubmissionDate = false; int columnIndex = 0; int submissionDateColumnIndex = 0; string columnValue = null; string submissionDateColumnValue = null; var searchCriteria = searchFields.ToList(); var column = searchColumn.ToList(); try { for (int i = 0, j = 0; i < searchCriteria.Count && j < column.Count; i++, j++) //Iterate 2 dictionaries together { // Click on Search Magnifying Icon present on My Lodgement tab LodgementPortalApp.log.LogInfo("Click on Search Magnifying Icon"); if (SearchMagnifyingIcon.FindElement(By.XPath("..")).GetAttribute("class").Contains("collapsed")) { SearchMagnifyingIcon.Click(); } LodgementPortalApp.log.LogInfo("Search Criteria is : " + column[j].Value + " AND value :" + searchCriteria[i].Value); // Select Status from dropdown if (searchCriteria[i].Key.GetAttribute("name").Equals("StatusId")) { HelperLibrary.SelectItem(searchCriteria[i].Key, searchCriteria[i].Value); findSubmissionDate = true; } // Click on show deleted checkbox else if (searchCriteria[i].Key.GetAttribute("type").Equals("checkbox")) { searchCriteria[i].Key.Click(); } else { // Enter Value to be searched searchCriteria[i].Key.Clear(); searchCriteria[i].Key.SendKeys(searchCriteria[i].Value); //MayurP added following line for period end date searchCriteria[i].Key.SendKeys(Keys.Tab); } // Click on search button SearchButton.Click(); // Get Column data if (!findSubmissionDate) { columnIndex = WebTableHelper.GetColumnIndex(searchGrid, column[j].Value); columnValue = WebTableHelper.GetCellFromTable(searchGrid, 0, columnIndex); } else // code to search and save submission date, required for searching submission date { columnIndex = WebTableHelper.GetColumnIndex(searchGrid, column[j].Value); columnValue = WebTableHelper.GetCellFromTable(searchGrid, 0, columnIndex); submissionDateColumnIndex = WebTableHelper.GetColumnIndex(searchGrid, LodgementPortalConstants.SUBMISSION_DATE); submissionDateColumnValue = WebTableHelper.GetCellFromTable(searchGrid, 0, submissionDateColumnIndex); if (submissionDateColumnValue != null) { string[] split = submissionDateColumnValue.Split(' '); HelperLibrary.RunTimeXMl.WriteNode("submissionDate", split[0]); } } if (columnValue.Contains(searchCriteria[i].Value)) { HelperLibrary.log.LogInfo(true, string.Format("Successfully Searched Record {0} with value {1} in My Lodgement tab", column[j].Value, searchCriteria[i].Value)); } else if (NoRecordFound.Displayed) { HelperLibrary.log.LogInfo(false, string.Format("Failed to Search Record {0} with value {1} in My Lodgement tab", column[j].Value, searchCriteria[i].Value)); flag = false; } // Click on Search Magnifying Icon present on My Lodgement tab SeleniumDriver.driver.FindElement(By.CssSelector(".glyphicon.glyphicon-search")); LodgementPortalApp.log.LogInfo("Click on Search Magnifying Icon"); Retry.Do(SearchMagnifyingIcon.Click); if (!searchCriteria[i].Key.GetAttribute("name").Equals("StatusId")) { searchCriteria[i].Key.Clear(); //As we do not have clear button, so we will clear field as soon as verification is done } } return(flag); } catch (Exception ex) { HelperLibrary.log.LogException(ex, ex.StackTrace); HelperLibrary.log.LogInfo("Failed to search record"); return(false); } }