Ejemplo n.º 1
0
        public static void SelectAgeGroup(AgeType age)
        {
            IWebElement divAge = LocalWait.Until(ExpectedConditions.ElementExists(By.ClassName(classNameToFind: "ageGroup")));
            IWebElement cboAge = LocalWait.Until(ExpectedConditions.ElementExists(By.ClassName(classNameToFind: "k-dropdown")));

            cboAge.Click();

            IWebElement select = LocalWait.Until(ExpectedConditions.ElementExists(By.Id(idToFind: "analAgeGroup-list")));
            ReadOnlyCollection <IWebElement> options = select.FindElements(By.TagName(tagNameToFind: "li"));

            for (int i = 0; i < options.Count; i++)
            {
                if (options[i].Text == age.ToString() && !IsAgeSelected(age))
                {
                    string jscript = string.Format(format: "$('#analAgeGroup').data('kendoDropDownList').select({0});", arg0: i);
                    try
                    {
                        ((IJavaScriptExecutor)Driver.Instance).ExecuteScript(jscript);
                        cboAge.Click();
                        ((IJavaScriptExecutor)Driver.Instance).ExecuteScript(script: "vrhProfileGrid.ChangedAgeGroup();");
                    }
                    catch (Exception ex)
                    {
                        jscript = string.Format(format: "alert('{0}');", arg0: ex.Message);
                        ((IJavaScriptExecutor)Driver.Instance).ExecuteScript(jscript);
                    }
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public static void SelectAgeGroupDoesNotWorkWithKendo(AgeType age)
        {
            IWebElement cbo      = LocalWait.Until(ExpectedConditions.ElementExists(By.ClassName(classNameToFind: "ageGroup")));
            IWebElement cboAge   = LocalWait.Until(ExpectedConditions.ElementExists(By.ClassName(classNameToFind: "k-dropdown")));
            var         ageGroup = new SelectElement(cboAge);

            ageGroup.SelectByValue(age.ToString());
        }
Ejemplo n.º 3
0
        public static bool IsAgeSelected(AgeType age)
        {
            Driver.PleaseWait();
            IWebElement divAge      = LocalWait.Until(ExpectedConditions.ElementExists(By.ClassName(classNameToFind: "ageGroup")));
            IWebElement cboAge      = LocalWait.Until(ExpectedConditions.ElementExists(By.ClassName(classNameToFind: "k-dropdown")));
            IWebElement ageSelected = LocalWait.Until(ExpectedConditions.ElementExists(By.ClassName(classNameToFind: "k-input")));

            return(ageSelected.Text == age.ToString());
        }