Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="DisplayDetails"></param>
        /// <param name="panelTitleId"></param>
        /// <param name="itemId"></param>
        /// <param name="itemText"></param>
        /// <returns></returns>
        public (bool result, IWebElement detailRow) Get_Row_In_Search_Results(
            ReadOnlyCollection <IWebElement> DisplayDetails
            , string panelTitleId
            , string itemId
            , string itemText)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "if (IsVisible(By.Id(panelTitleId)))";
            if (IsVisible(By.Id(panelTitleId)))
            {
                TraceLine = "if (IsClickable(DisplayDetails[0]))";
                if (IsClickable(DisplayDetails[0]))
                {
                    TraceLine = "var (result, detailRow) = Get_Detail_Row_By_ItemText(";
                    var(result, detailRow) = Get_DisplayDetail(DisplayDetails, By.Id(itemId), itemText);

                    if (result)
                    {
                        return(true, detailRow);
                    }
                }
            }
            TraceFailed.ShouldBe(TraceLine);
            return(false, null);
        }
Exemple #2
0
        /// <summary>
        /// Pattern: If link is clickable, then click link and wait for Pin Wheel to stop;
        /// If frame is visible, then switch to that frame;
        /// </summary>
        /// <param name="modalLink"></param>
        /// <param name="iframe"></param>
        /// <returns></returns>
        public bool SwitchFrame(IWebElement modalLink, string iframe)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "if (IsClickable(modalLink))";
            if (IsClickable(modalLink))
            {
                TraceLine = "modalLink.Click();";
                modalLink.Click();

                TraceLine = "if (WaitForPinwheel(Constants.PINWHEELMODALOVERLAY))";
                if (WaitForPinwheel(Constants.PINWHEELMODALOVERLAY))
                {
                    TraceLine = "if (IsVisible(By.Id(iframe)))";
                    if (IsVisible(By.Id(iframe)))
                    {
                        TraceLine = "SwitchToFrame(iframe);";
                        SwitchToFrame(iframe);
                        return(true);
                    }
                }
            }
            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #3
0
        /// <summary>
        /// For each row, return the row when the itemTofindBy field contains the itemText
        /// </summary>
        /// <param name="displayDetails"></param>
        /// <param name="itemToFindBy"></param>
        /// <param name="itemText"></param>
        /// <returns></returns>
        public (bool result, IWebElement detailRow) Get_DisplayDetail(
            ReadOnlyCollection <IWebElement> displayDetails
            , By itemToFindBy
            , string itemText)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            WaitFor.WaitForPageLoad(); // TODO: should already be loaded before getting here...remove waits

            TraceLine = "if (IsClickable(displayDetails[0]))";
            if (IsClickable(displayDetails[0]))
            {
                TraceLine = "foreach (IWebElement detailRow in displayDetails)";
                foreach (IWebElement detailRow in displayDetails)
                {
                    //TraceLine = "if (detailRow.FindElement(itemToFindBy).Text.Contains(itemText))";
                    TraceLine = $"[+] detailRow ItemText : {detailRow.FindElement(itemToFindBy).Text}";
                    if (detailRow.FindElement(itemToFindBy).Text.Contains(itemText))
                    {
                        TraceLine = $"[+] Found ItemText : {detailRow.Text}";
                        return(true, detailRow);
                    }
                }
            }
            TraceFailed.ShouldBe(TraceLine);
            return(false, null);
        }
Exemple #4
0
        public bool Click_Eye_Icon(IWebElement row, By by)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "if (IsClickable(by))";
            if (IsClickable(by))
            {
                TraceLine = "var eye = row.FindElement(by);";
                var eye = row.FindElement(by);

                if (eye != null)
                {
                    TraceLine = "eye.Click();";
                    eye.Click();
                    WaitForPinwheel(Constants.PINWHEELOVERLAY);
                    WaitFor.WaitForPageLoad();
                    return(true);
                }
                TraceFailed.ShouldBe(TraceLine);
                return(false);
            }

            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="displayRows"></param>
        /// <param name="itemToFind_Id"></param>
        /// <param name="itemText"></param>
        /// <returns></returns>
        public (bool result, string value) Search_Results_Contain(ReadOnlyCollection <IWebElement> displayRows
                                                                  , string itemToFind_Id
                                                                  , string itemText)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "foreach (IWebElement row in displayRows)";
            var found = false;

            foreach (IWebElement row in displayRows)
            {
                if (DisplayDetail_Contains(row, By.Id(itemToFind_Id), itemText))
                {
                    found = true;
                    continue;
                }
                else
                {
                    // All must be Active...otherwise, error
                    found = false;
                    break;
                }
            }

            if (found)
            {
                return(true, itemText);
            }

            TraceFailed.ShouldBe($"DisplayDetail_Contains did not find itemText {itemText}");
            return(false, null);
        }
Exemple #6
0
        //public void ClickElement(By by)
        //{
        //    // Extra click required for Loan Profile Name filter field (Bug reported 06/11/19)
        //    var extraClick = Browser.FindElement(by);
        //    extraClick.Click();
        //}

        //public void ClickElement(IWebElement element)
        //{
        //    element.Click();
        //}
        #endregion

        #region Dropdown List
        /// <summary>
        /// Activate the dropdown; select the dropdown from the list of items;
        /// </summary>
        /// <param name="dropDownAnchor"></param>
        /// <param name="dropDownList"></param>
        /// <param name="textToFind"></param>
        /// <returns></returns>
        public bool Select_Dropdown_By_Listitem(IWebElement dropDownAnchor
                                                , ReadOnlyCollection <IWebElement> dropDownList
                                                , string textToFind)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "if (!Activate_Dropdown(dropDownAnchor))";
            if (!Activate_Dropdown(dropDownAnchor))
            {
                TraceFailed.ShouldBe($"[-] Activate_Dropdown for Anchor {dropDownAnchor} Failed");
                return(false);
            }

            WaitFor.WaitForPageLoad();

            TraceLine = "if (dropDownList.Count > 0)";
            if (dropDownList.Count > 0)
            {
                // Find the "textToFind" in the list items and click the item
                TraceLine = "foreach (IWebElement dropdown in dropDownList)";
                foreach (IWebElement dropdown in dropDownList)
                {
                    TraceLine = $"[+] dropdown text : {dropdown.Text}";
                    if (dropdown.Text.Contains(textToFind))
                    {
                        TraceLine = $"[+] dropdown click()";
                        dropdown.Click();
                        WaitFor.WaitForPageLoad();
                        return(true);
                    }
                }
            }
            TraceFailed.ShouldBe($"[-] Select_Dropdown_By_Listitem did not find {textToFind}");
            return(false);
        }
Exemple #7
0
 public bool IsPageLoaded()
 {
     TraceLine = "if (!IsPageTitle(Constants.TITLE.Organizations))";
     if (IsPageTitle(Constants.TITLE.Organizations))
     {
         return(true);
     }
     TraceFailed.ShouldBe(TraceLine);
     return(false);
 }
Exemple #8
0
 public bool IsPageLoaded()
 {
     TraceLine = "if (!IsPageTitle(Constants.TITLE.Contacts_Report))";
     if (IsPageTitle(Constants.TITLE.Contacts_Report))
     {
         return(true);
     }
     TraceFailed.ShouldBe(TraceLine);
     return(false);
 }
 public bool IsPageLoaded()
 {
     TraceLine = "if (!IsPageTitle(Constants.TITLE.Manage_Security_Groups))";
     if (IsPageTitle(Constants.TITLE.Manage_Security_Groups))
     {
         return(true);
     }
     TraceFailed.ShouldBe(TraceLine);
     return(false);
 }
Exemple #10
0
        }   // the value to be selected

        /// <summary>
        /// Set_Filter_Field
        /// </summary>
        /// <param name="filterField"></param>
        /// <param name="fullData"></param>
        /// <returns></returns>
        public bool Set_Filter_Field(IWebElement filterField, string filterData)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());
            TraceLine = $"SendKeys Filter Field : {filterField} Filter Data : {filterData}";
            if (SendKeys_to_Target(filterField, filterData))
            {
                return(true);
            }
            TraceFailed.ShouldBe($"[-] Failed - SendKeys Filter Field : {filterField} Filter Data : {filterData}");
            return(false);
        }
Exemple #11
0
        public bool View_Record(string Eye_Icon_Hyperlink)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            if (!Click_Eye_Icon(DetailRow, By.CssSelector(Eye_Icon_Hyperlink)))
            {
                TraceFailed.ShouldBe(TraceLine);
                return(false);
            }

            return(true);
        }
Exemple #12
0
        public bool Set_Field_Value(IWebElement field, string data)
        {
            TraceLine = "if (IsClickable(field))";
            if (IsClickable(field))
            {
                field.SendKeys(data);
                WaitFor.WaitForPageLoad();
                return(true);
            }

            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #13
0
        public bool Set_Toggle(IWebElement toggle)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());
            TraceLine = "if (IsClickable(toggle))";
            if (IsClickable(toggle))
            {
                toggle.Click();
                WaitFor.WaitForPageLoad();
                return(true);
            }

            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #14
0
        public bool Set_Element_Value(IWebElement element, string value)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());
            TraceLine = "if (IsClickable(" + element + "))";
            if (IsClickable(element))
            {
                element.Clear(); // 02/07/20
                element.SendKeys(value);
                return(true);
            }

            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #15
0
        public bool SendKeys_Clear(IWebElement targetFilter)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "if (IsClickable(targetFilter))";
            if (IsClickable(targetFilter))
            {
                TraceLine = "targetFilter.Clear();";
                targetFilter.Clear();

                return(true);
            }
            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dropDown"></param>
        /// <returns></returns>
        public bool Activate_Dropdown(IWebElement dropDown)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "if (IsClickable(dropDown))";
            if (IsClickable(dropDown))
            {
                // Must click dropdown to expose the list items
                dropDown.Click();
                return(true);
            }

            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #17
0
        public bool Set_Dropdown(IWebElement anchor, string dataToAssign)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());
            TraceLine = "if (IsClickable(anchor))";
            if (IsClickable(anchor))
            {
                anchor.Click();
                WaitFor.WaitForPageLoad();
                anchor.SendKeys(dataToAssign);
                WaitFor.WaitForPageLoad();
                return(true);
            }

            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #18
0
        public (bool result, IWebElement detailRow) Get_Any_SearchResults(
            ReadOnlyCollection <IWebElement> displayDetails)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            // Base Class
            var(result, detailRow) = Get_Any_DisplayDetail(displayDetails);
            DetailRow = detailRow;

            if (result)
            {
                return(true, detailRow);
            }

            TraceFailed.ShouldBe(TraceLine);
            return(false, null);
        }
Exemple #19
0
        /// <summary>
        /// For a given row, return true if the itemToFind_Id contain the itemText
        /// </summary>
        /// <param name="displayDetail"></param>
        /// <param name="itemToFind_Id"></param>
        /// <param name="itemText"></param>
        /// <returns></returns>
        public bool DisplayDetail_Contains(IWebElement displayDetail
                                           , By itemToFind_Id
                                           , string itemText)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "if (IsClickable(displayDetail))";
            if (IsClickable(displayDetail))
            {
                TraceLine = "if (displayDetail.FindElement(itemToFind_Id).Text.Contains(itemText))";
                if (displayDetail.FindElement(itemToFind_Id).Text.Contains(itemText))
                {
                    return(true);
                }
            }
            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #20
0
        /// <summary>
        /// For each row, return the row;
        /// </summary>
        /// <param name="displayDetails"></param>
        /// <returns></returns>
        public (bool result, IWebElement detailRow) Get_Any_DisplayDetail(
            ReadOnlyCollection <IWebElement> displayDetails)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            WaitFor.WaitForPageLoad();// ToDo: should already be loaded before getting here...remove waits

            TraceLine = "if (IsClickable(displayDetails[0]))";
            if (IsClickable(displayDetails[0]))
            {
                TraceLine = "foreach (IWebElement detailRow in displayDetails)";
                foreach (IWebElement detailRow in displayDetails)
                {
                    return(true, detailRow);
                }
            }
            TraceFailed.ShouldBe(TraceLine);
            return(false, null);
        }
Exemple #21
0
        public bool Set_WYSIWYG_CKE(string text)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            IWebElement frame = Browser.FindElement(By.ClassName("cke_wysiwyg_frame"));

            Browser.SwitchTo().Frame(frame);
            IWebElement body = Browser.FindElement(By.XPath("//html/body"));

            TraceLine = "if (IsClickable(desc))";
            if (IsClickable(body))
            {
                body.Clear(); // 02/07/20 - HP
                body.SendKeys(text);
                Browser.SwitchTo().ParentFrame();
                return(true);
            }

            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }
Exemple #22
0
        /// <summary>
        /// Set filter field in two steps:
        /// 1. Set filterField with a subset of the filterText that we are looking for...
        /// 2. Using the filterXpath, a dropdown list will appear;
        /// 2. Iterate the dropdown list matching on filterValue;
        /// </summary>
        /// <param name="filterField"></param>
        /// <param name="filterText"></param>
        /// <param name="filterXpath"></param>
        /// <param name="filterValue"></param>
        /// <returns></returns>
        public bool Set_Filter_Field_By_Text(IWebElement filterField    // The filter field to set
                                             , string filterText        // Subset of the actual filterValue
                                             , string filterXpath       // Dropdown of values
                                             , string filterValue)      // Value to select from dropdown
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            TraceLine = "if (Set_Filter_Field(filterField, filter)";

            // Filter Fields need an extra click to work properly (HACK)
            var filterField_label = filterField.GetAttribute("Id") + "-Label";
            var clickOnLabel_hack = Browser.FindElement(By.Id(filterField_label));

            if (Set_Filter_Field(filterField, filterText))
            {
                WaitFor.WaitForPageLoad();

                TraceLine = $"Browser.FindElements By.XPath : {filterXpath}";

                IList <IWebElement> filterList = Browser.FindElements(By.XPath(filterXpath));
                TraceLine = $" if filterList.count > 0 : {filterList.Count} > 0 :  ";

                if (filterList.Count > 0)
                {
                    TraceLine = "foreach (IWebElement filterItem in filterList)";
                    foreach (IWebElement filterItem in filterList)
                    {
                        if (filterItem.Text.Contains(filterValue))
                        {
                            filterItem.Click();
                            clickOnLabel_hack.Click();
                            return(true);
                        }
                    }
                }
                return(false);
            }
            TraceFailed.ShouldBe(TraceLine);
            return(false);
        }   // the value to be selected
Exemple #23
0
        /// <summary>
        /// For a given row, return (true, value) if the itemTofindBy field contains non null value;
        /// </summary>
        /// <param name="displayRow"></param>
        /// <param name="findBy"></param>
        /// <returns></returns>
        public (bool result, string value) Get_DisplayDetail_ItemValue(
            IWebElement displayRow
            , By itemToFindBy)
        {
            PrintCurrentMethod(MethodBase.GetCurrentMethod());

            // Wait for search results to be displayed
            TraceLine = "if (IsClickable(displayRow))";
            if (IsClickable(displayRow))
            {
                TraceLine = "if (displayRow != null)";
                if (displayRow != null)
                {
                    TraceLine = "displayRow.FindElement(by).Text.ToString();";
                    try
                    {
                        var value = displayRow.FindElement(itemToFindBy).Text.ToString();
                        if (!string.IsNullOrEmpty(value))
                        {
                            return(result : true, value : value);
                        }
                        else
                        {
                            return(result : false, value : value);
                        }
                    }
                    catch (NoSuchElementException)
                    {
                        TraceLine = "[-]********** catch (NoSuchElementException) ";
                        return(result : false, value : null);
                    }
                }
            }

            TraceFailed.ShouldBe(TraceLine);
            return(result : false, value : null);
        }