예제 #1
0
        public static IWebElement FindElement(Keyword keyword, IWebDriver driver, ObjectInfo objInfo)
        {
            _browser = driver;

            _wait = new WebDriverWait(_browser, TimeSpan.FromSeconds(WaitSeconds));

            _browser.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(WaitSeconds));

            var el = GetByLabel(keyword, objInfo);

            if (el == null)
            {
                var getby = GetBy(objInfo);

                el = _wait.Until(ExpectedConditions.ElementIsVisible(getby));
            }

            return el;
        }
예제 #2
0
        private static IWebElement GetByLabel(Keyword keyword, ObjectInfo objInfo)
        {
            IWebElement el = null;
            switch (objInfo.Type.ToLower())
            {

                case "bycontext":                   //ByContext
                    switch (keyword.GetType().Name)
                    {
                        case "SendKeys":
                            el = FindTargetByContext(objInfo.Value, TextboxSelector);
                            break;
                        case "SendKeysInEditor":
                            //el = FindEditorByContext(objInfo.Value);
                            el = FindTargetByContext(objInfo.Value, "iframe");
                            break;
                        case "ClickExtCheckbox":
                            el = FindTargetByContext(objInfo.Value, ExtJsCheckboxSelector);
                            break;
                        case "SelectExtJSCombo":
                            el = FindTargetByContext(objInfo.Value, TextboxSelector);
                            break;
                        default:
                            el = FindTargetByContext(objInfo.Value, ClickableSelector, objInfo.Extra);

                            break;
                    }
                    break;
                case "byinnertext":                 //ByInnerText
                    el = FindClickableByInnerText(objInfo.Value, objInfo.Extra);
                    break;

            }
            return el;
        }