예제 #1
0
        public static IWebElement GetSeleItemControl(this WebDriverWait wait, string idStr)
        {
            SeleItem ctrl = string.IsNullOrWhiteSpace(idStr) ? null : GetSeleItem(idStr);
            By       by   = null;

            switch (ctrl.Id)
            {
            case EnumSelenium.ID:
                by = By.Id(ctrl.Value);
                break;

            case EnumSelenium.NAME:
                by = By.Name(ctrl.Value);
                break;

            case EnumSelenium.TAG:
                by = By.TagName(ctrl.Value);
                break;

            case EnumSelenium.CSS:
                by = By.CssSelector(ctrl.Value);
                break;

            case EnumSelenium.XPATH:
                by = By.XPath(ctrl.Value);
                break;

            default:
                App.ErrorList.Add("");
                return(null);
            }

            return(wait.Until(drv => drv.FindElement(by)));
        }
예제 #2
0
        public static SeleItem GetSeleItem(string str)
        {
            SeleItem result = new SeleItem();

            if (str.Substring(0, 1) != "$")
            {
                result.Value = str;
            }
            else if (str.IndexOf(":") <= 0)
            {
                result.Id = GetSeleniumType(str.Substring(1));
            }
            else
            {
                result.Id    = GetSeleniumType(str.Substring(1, str.IndexOf(":") - 1));
                result.Value = str.Substring(str.IndexOf(":") + 1);
            };

            return(result);
        }
예제 #3
0
        public void DoEvent(SeleniumEventItem item, List <SeleniumControlItem> ControlList)
        {
            IWebElement e = null;

            if (!string.IsNullOrWhiteSpace(item.No))
            {
                string id = ControlList.Where(x => x.No == item.No).Select(x => x.Id).FirstOrDefault();
                if (string.IsNullOrWhiteSpace(id))
                {
                    App.ErrorList.Add("err er 1");
                }
                else
                {
                    e = Wait.GetSeleItemControl(id);
                    if (e == null)
                    {
                        App.ErrorList.Add($"{id}not find err er 2");
                    }
                }
            }

            SeleItem eve = SeleniumUtiltity.GetSeleItem(item.Event);

            switch (eve.Id)
            {
            case EnumSelenium.ALL:
                e.SendKeys(eve.Value);
                break;

            case EnumSelenium.BACK:
                break;

            case EnumSelenium.CLEAR:
                e.Clear();
                break;

            case EnumSelenium.CLICK:
                e.Click();
                break;

            case EnumSelenium.COMBO:
                break;

            case EnumSelenium.FORWARD:
                break;

            case EnumSelenium.FULLSCREEN:
                break;

            case EnumSelenium.KEY:
                break;

            case EnumSelenium.LOSTFOCUSE:
                break;

            case EnumSelenium.MAXSIZE:
                break;

            case EnumSelenium.MINSIZE:
                break;

            case EnumSelenium.PIC:
                break;

            case EnumSelenium.REFRESH:
                break;

            case EnumSelenium.TABLE:
                break;

            default:
                break;
            }
        }