コード例 #1
0
        protected void SelectFromList_ByIndex(AutomatedElement Element, int Index, ElementValidation Validation)
        {
            //Find Element
            FindVisibleElement(20, Element, "Drop down Menu", ElementValidation.Mandatory);

            //Hover On Element
            HoverElement(Element);

            try
            {
                //Select from the list
                new SelectElement(driver.driver.FindElement(Element.ByElement)).SelectByIndex(Index);
            }

            catch
            {
                if (Validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage("Option " + Index, MessageType.CantSelectFromListMsg, Validation);
                    testMessages.End_Test();
                }

                else if (Validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage("Option " + Index, MessageType.CantSelectFromListMsg, Validation);
                }

                else if (Validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage("Option " + Index, MessageType.CantSelectFromListMsg, Validation);
                }
            }
        }
コード例 #2
0
        private void ClearElement(AutomatedElement Element, String ElementName, ElementValidation Validation)
        {
            try
            {
                driver.driver.FindElement(Element.ByElement).Clear();
            }
            catch
            {
                if (Validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(ElementName, MessageType.CantClearMsg, Validation);

                    testMessages.End_Test();
                }

                else if (Validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.CantClearMsg, Validation);
                }

                else if (Validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.CantClearMsg, Validation);
                }
            }
        }
コード例 #3
0
        protected void ClickElement(AutomatedElement Element, String ElementName, ElementValidation validation)
        {
            if (IsElementEnabled(Element))
            {
                try
                {
                    //Hover on the Element
                    HoverElement(Element);

                    driver.driver.FindElement(Element.ByElement).Click();
                }
                catch
                {
                    if (validation == ElementValidation.Mandatory)
                    {
                        testMessages.Mandatory_Message = Messages.ReturnMessage(ElementName, MessageType.UnClickableMsg, validation);

                        testMessages.End_Test();
                    }

                    else if (validation == ElementValidation.Non_Mandatory)
                    {
                        testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.UnClickableMsg, validation);
                    }

                    else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                    {
                        testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.UnClickableMsg, validation);
                    }
                }
            }
            else
            {
                if (validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(ElementName, MessageType.NotEnabledMsg, validation);

                    testMessages.End_Test();
                }

                else if (validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.NotEnabledMsg, validation);
                }

                else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.NotEnabledMsg, validation);
                }
            }
        }
コード例 #4
0
        protected void EnterText_UsingJS(AutomatedElement Element, string text, string ElementName, ElementValidation validation)
        {
            IWebElement         elmnt = driver.driver.FindElement(Element.ByElement);
            IJavaScriptExecutor js    = (IJavaScriptExecutor)driver.driver;

            try
            {
                js.ExecuteScript("arguments[0].value = '" + text + "';", elmnt);
            }

            catch
            {
                if (validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(ElementName, MessageType.CantSendKeysMsg, validation);

                    testMessages.End_Test();
                }

                else if (validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.CantSendKeysMsg, validation);
                }

                else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.CantSendKeysMsg, validation);
                }
            }
        }
コード例 #5
0
 public void Ensure_Session_Title_SessionView_IsCorrect(string SessionTitle, ElementValidation validation)
 {
     Ensure_ElementTxt_IsCorrect(lbl_SessionTitle, SessionTitle, "Session Title", validation);
 }
コード例 #6
0
ファイル: FundaHome_Page.cs プロジェクト: SalmaAssem/Funda
 public void Assert_LastQueryCotainsCorrectCriteria(List <string> CriteriaList, ElementValidation validation)
 {
     for (int i = 0; i < CriteriaList.Count; i++)
     {
         Assert_Element_Contains_Text(lnk_LastQuery, CriteriaList[i], "Last Search Query", validation);
     }
 }
コード例 #7
0
ファイル: FundaHome_Page.cs プロジェクト: SalmaAssem/Funda
 public void Assert_LocationRangeList_NotDisplayed(ElementValidation validation)
 {
     Assert_Element_NotFound(2, select_LocationRange, "Location Range List", validation, validation);
 }
コード例 #8
0
        public void Assert_ApartmentPriceMatchesSearchCriteria(string MinmumPrice, string MaximumPrice, OfferTypes Offer, ElementValidation validation)
        {
            int ResultInPrice = 0;

            if (Offer == OfferTypes.ForSale)
            {
                string ApartmentPriceText = ReturnElementText(span_ApartmentPrice).Trim(',', 'k', 'k', '.', '.', '€', ' ', ' ');

                ResultInPrice = int.Parse(ApartmentPriceText, NumberStyles.Currency);
            }


            else if (Offer == OfferTypes.ForRent)
            {
                ResultInPrice = int.Parse(ReturnElementText(span_ApartmentPrice).Trim('d', 'm', 'n', '/', '.', '€', ' '));
            }


            int MinPrice = int.Parse(MinmumPrice.Trim('€', ','), NumberStyles.Currency);
            int MaxPrice = 0;

            if (MaximumPrice == "No limit")
            {
                Assert_Number_GreaterThanAnotherNumber(ResultInPrice, MinPrice, "Apartment Price", validation);
            }

            else
            {
                MaxPrice = int.Parse(MaximumPrice.Trim('€', ','), NumberStyles.Currency);
                Assert_Number_BetweenTwoNumbers(ResultInPrice, MinPrice, MaxPrice, "Apartment Price", validation);
            }
        }
コード例 #9
0
ファイル: Validations.cs プロジェクト: SalmaAssem/Funda
        protected void Assert_Number_BetweenTwoNumbers(int NumberToCheck, int Min, int Max, string Element_Tag, ElementValidation validation)
        {
            //Check if NumberToCheck is between Min and Max
            if (NumberToCheck >= Min && NumberToCheck <= Max)
            {
            }

            else
            {
                if (validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);

                    testMessages.End_Test();
                }

                else if (validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                }



                else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                }
            }
        }
コード例 #10
0
ファイル: Validations.cs プロジェクト: SalmaAssem/Funda
        protected void Assert_Element_Contains_Text(AutomatedElement Element, string Expected_Text, string Element_Tag, ElementValidation validation)
        {
            //Find Element
            FindVisibleElement(30, Element, Element_Tag, validation);

            //Get Element Text
            string ElementInnerText = driver.driver.FindElement(Element.ByElement).Text;

            //Check if Element text contains Expected text
            if (driver.driver.FindElement(Element.ByElement).Text.ToLower().Contains(Expected_Text.ToLower()))
            {
            }

            else
            {
                if (validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message  = Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                    testMessages.Mandatory_Message += "\n The actual is '" + ElementInnerText + "' but expected '" + Expected_Text + "'";

                    testMessages.End_Test();
                }

                else if (validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                    testMessages.Non_Mandatory_Message += "\n The actual is '" + ElementInnerText + "' but expected '" + Expected_Text + "'";
                }


                else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n The actual is '" + ElementInnerText + "' but expected '" + Expected_Text + "'";
                }
            }
        }
コード例 #11
0
ファイル: Validations.cs プロジェクト: SalmaAssem/Funda
        protected void Assert_Element_NotFound(double Time, AutomatedElement Element, String ElementName, ElementValidation ExistanceValidation, ElementValidation VisibilityValidation)
        {
            Thread.Sleep(TimeSpan.FromSeconds(Time));

            if (IsElementPresent(Element))
            {
                if (ExistanceValidation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(ElementName, MessageType.FoundInInvalidPlaceMsg, ExistanceValidation);
                    testMessages.End_Test();
                }

                else if (ExistanceValidation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.FoundInInvalidPlaceMsg, ExistanceValidation);
                }

                else if (ExistanceValidation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.FoundInInvalidPlaceMsg, ExistanceValidation);
                }



                if (IsElementVisible(Element))
                {
                    if (VisibilityValidation == ElementValidation.Mandatory)
                    {
                        testMessages.Mandatory_Message = Messages.ReturnMessage(ElementName, MessageType.VisibleInInvalidPlaceMsg, VisibilityValidation);
                        testMessages.End_Test();
                    }

                    else if (VisibilityValidation == ElementValidation.Non_Mandatory)
                    {
                        testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.VisibleInInvalidPlaceMsg, VisibilityValidation);
                    }

                    else if (VisibilityValidation == ElementValidation.Non_Mandatory_Till_EOT)
                    {
                        testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.VisibleInInvalidPlaceMsg, VisibilityValidation);
                    }
                }
            }
        }
コード例 #12
0
        public static string ReturnMessage(String ElementName, MessageType messageType, ElementValidation validation)
        {
            switch (messageType)
            {
            case MessageType.NotFoundMsg:
                return("Unable to locate element [" + ElementName + "] _ [" + validation + "]");

                break;

            case MessageType.UnClickableMsg:
                return("Unable to click on element [" + ElementName + "] _ [" + validation + "]");

                break;

            case MessageType.NotVisibleMsg:
                return("This Element isn't visible [" + ElementName + "] _ [" + validation + "]");

                break;

            case MessageType.NotEnabledMsg:
                return("This Element is not enabled  [ " + ElementName + " ] _ [ " + validation + " ]");

                break;

            case MessageType.CantSendKeysMsg:
                return("Unable to enter text to element " + ElementName + "] _ [" + validation + "]");

                break;

            case MessageType.CantClearMsg:
                return("Unable to clear element " + ElementName + "] _ [" + validation + "]");

                break;

            case MessageType.NoSuchFrameMsg:
                return("Unable to find Frame " + ElementName + "] _ [" + validation + "]");

                break;

            case MessageType.FoundInInvalidPlaceMsg:
                return("Element " + ElementName + "] is found in invalid place _ [" + validation + "]");

                break;

            case MessageType.VisibleInInvalidPlaceMsg:
                return("Element " + ElementName + "] is visible in invalid place _ [" + validation + "]");

                break;

            case MessageType.EnabledInInvalidPlaceMsg:
                return("Element " + ElementName + "] is enabled in invalid place _ [" + validation + "]");

                break;

            case MessageType.CantSelectFromListMsg:
                return("Can't Select  " + ElementName + "] From List _ [" + validation + "]");

                break;

            case MessageType.NotSelectedMsg:
                return("Element " + ElementName + "] isn't selected [" + validation + "]");

                break;

            case MessageType.NotCorrect:
                return("Element " + ElementName + "] text isn't correct [" + validation + "]");

                break;

            case MessageType.WrongColor:
                return("Element " + ElementName + "] color isn't correct [" + validation + "]");

                break;

            default:
                return("Invalid Operation with" + ElementName);

                break;
            }
        }
コード例 #13
0
 public void Ensure_Session_Time_SessionView_IsCorrect(string SessionTime, ElementValidation validation)
 {
     Ensure_Element_Contains_Text(lbl_sessionTime, SessionTime, "Session Time", validation);
 }
コード例 #14
0
 public void Ensure_Session_Duration_SessionView_IsCorrect(string SessionDuration, ElementValidation validation)
 {
     Ensure_Element_Contains_Text(lbl_sessionDuration, SessionDuration, "Session Duration", validation);
 }
コード例 #15
0
 public void Ensure_Session_Objectives_SessionView_IsCorrect(string SessionObjectives, ElementValidation validation)
 {
     Ensure_ElementTxt_IsCorrect(lbl_sessionObjectives, SessionObjectives, "Session Objectives", validation);
 }
コード例 #16
0
ファイル: Validations.cs プロジェクト: SalmaAssem/Funda
        protected void Assert_Number_GreaterThanAnotherNumber(int NumberToCheck, int Min, string Element_Tag, ElementValidation validation)
        {
            //Check if NumberToCheck is greater than Min
            if (NumberToCheck >= Min)
            {
            }

            else
            {
                if (validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);

                    testMessages.End_Test();
                }

                else if (validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                }



                else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                }
            }
        }
コード例 #17
0
 public void Assert_AddressContains_SearchAddress(string SearchAddress, ElementValidation validation)
 {
     Assert_Element_Contains_Text(span_ApartmentAddress, SearchAddress, SearchAddress, validation);
 }
コード例 #18
0
ファイル: Validations.cs プロジェクト: SalmaAssem/Funda
        public void ElementColor_IsCorrect(AutomatedElement Element, int r, int g, int b, string Element_Tag, ElementValidation validation)
        {
            string ElementColor = driver.driver.FindElement(Element.ByElement).GetCssValue("color");

            ElementColor = ElementColor.Trim('r', 'g', 'b', 'a', '(', ')');

            string[] a = ElementColor.Split(',');

            if (r == int.Parse(a[0]) && g == int.Parse(a[1]) && b == int.Parse(a[2]))
            {
            }

            else
            {
                if (validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);

                    testMessages.End_Test();
                }

                else if (validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                }



                else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(Element_Tag, MessageType.NotCorrect, validation);
                }
            }
        }
コード例 #19
0
 public void Assert_NoResultMessage_Displayed(ElementValidation validation)
 {
     FindVisibleElement(20, lbl_NoResult, "No Search Result Message", validation);
 }
コード例 #20
0
ファイル: Validations.cs プロジェクト: SalmaAssem/Funda
        protected void FindVisibleElement(double Time, AutomatedElement Element, String ElementName, ElementValidation validation)
        {
            WebDriverWait wait = new WebDriverWait(driver.driver, TimeSpan.FromSeconds(Time));

            try
            {
                wait.Until(ExpectedConditions.ElementExists(Element.ByElement));
            }
            catch
            {
                if (validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(ElementName, MessageType.NotFoundMsg, validation);
                    testMessages.End_Test();
                }

                else if (validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.NotFoundMsg, validation);
                }

                else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.NotFoundMsg, validation);
                }
            }

            //Ensure Element is visible
            try
            {
                wait.Until(ExpectedConditions.ElementIsVisible(Element.ByElement));
            }
            catch
            {
                if (validation == ElementValidation.Mandatory)
                {
                    testMessages.Mandatory_Message = Messages.ReturnMessage(ElementName, MessageType.NotVisibleMsg, validation);

                    testMessages.End_Test();
                }

                else if (validation == ElementValidation.Non_Mandatory)
                {
                    testMessages.Non_Mandatory_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.NotVisibleMsg, validation);
                }

                else if (validation == ElementValidation.Non_Mandatory_Till_EOT)
                {
                    testMessages.Non_Mandatory_Till_EOT_Message += "\n" + Messages.ReturnMessage(ElementName, MessageType.NotVisibleMsg, validation);
                }
            }
        }
コード例 #21
0
ファイル: FundaHome_Page.cs プロジェクト: SalmaAssem/Funda
 public void Assert_MaximumPriceList_NotDisplayed(ElementValidation validation)
 {
     Assert_Element_NotFound(2, select_MaxPrice, "Maximum Price List", validation, validation);
 }
コード例 #22
0
        protected void EnterText_ToElement(AutomatedElement Element, string Key, String ElementName, ElementValidation validation)
        {
            //Clear Element
            ClearElement(Element, ElementName, validation);

            //Send Keys to element
            SendKeystoElement(Element, Key, ElementName, validation);
        }
コード例 #23
0
ファイル: FundaHome_Page.cs プロジェクト: SalmaAssem/Funda
        public void Assert_MaxPrice_Color_IsCorrect(ElementValidation validation)
        {
            ColorObject MaxPriceColor = new ColorObject(240, 60, 48);

            ElementColor_IsCorrect(select_MaxPrice, MaxPriceColor.r, MaxPriceColor.g, MaxPriceColor.b, "Max Price Color", validation);
        }
コード例 #24
0
        public void Ensure_Session_IsDisplayed_CourseMap(string SessionTitle, ElementValidation validation)
        {
            AutomatedElement lbl_SessionInMap = new AutomatedElement(LocateBy.XPath, LocatorValue: "//*[@title='" + SessionTitle + "']");

            ExplicitlyConfirm_ElementFound(20, lbl_SessionInMap, "Session with Title " + SessionTitle, validation);
        }