コード例 #1
0
 public bool VerifyFormNameExistInTable(string formname)
 {
     try
     {
         IList <string> li    = WebTableHelper.GetAllValuesInTable(formsTable);
         bool           found = false;
         //foreach (var item in li)
         for (int k = 0; k < li.Count; k++)
         {
             if ((li[k].Equals(formname)))
             {
                 logs.Info("Form Name verified : " + formname);
                 found = true;
                 return(true);
                 //break;
             }
         }
         logs.Error("Form Name not verified : " + formname);
         return(false);
     }
     catch (Exception e)
     {
         logs.Error(e.StackTrace);
         GenericHelper.TakeScreenshotForMePlease();
         throw;
     }
     //return new PageClass_Forms(driver);
 }
コード例 #2
0
        /// <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);
            }
        }
コード例 #3
0
        public PageClass_EnterStudyDetail SelectStudy(string study, string protocol)
        {
            int actrow = WebTableHelper.GetRowByStudyNameAndProtcol(tableStudies, study, protocol);

            if (!WebTableHelper.ClickButtonInColInTable(tableStudies, actrow, 2))
            {
                logs.Info("Failed to select the study : " + study + " having protcol:" + protocol);
                Console.WriteLine("Failed");
            }
            logs.Info("Pass: Clicked on the study : " + study + " having protcol:" + protocol);
            return(new PageClass_EnterStudyDetail(driver));
        }
コード例 #4
0
        /// <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);
            }
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebTablePage"/> class.
 /// </summary>
 /// <param name="webDriverContext">The web driver context.</param>
 public WebTablePage(WebDriverContext webDriverContext)
 {
     PageFactory.InitElements(webDriverContext.WebDriver, this);
     this.webTable = new WebTableHelper(this.webTableWebElement);
 }
コード例 #6
0
        /// <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);
            }
        }