Esempio n. 1
0
        public void PresssKeyOnElementWith(KeyboardActionType keyName, SelectorPathType selector, string path)
        {
            var elementBy = WebElementUtils.GetElementAsBy(selector, path);
            var element   = _driver.FindElement(elementBy);

            KeyboardUtils.EnterKeyToWebElement(element, keyName);
        }
Esempio n. 2
0
 public KeyboardData GetData(KeyboardActionType type)
 {
     int typeID = (int)type;
     if (!kvDic.ContainsKey(typeID))
     {
         BaseLogger.LogFormat("No such keyboard type: {0}", type);
     }
     return kvDic[typeID];
 }
Esempio n. 3
0
        public static void EnterKeyToWebElement(IWebElement element, KeyboardActionType keyboardActionType)
        {
            switch (keyboardActionType)
            {
            case KeyboardActionType.ENTER:
                element.SendKeys(Keys.Enter);
                break;

            case KeyboardActionType.ESCAPE:
                element.SendKeys(Keys.Escape);
                break;

            case KeyboardActionType.TAB:
                element.SendKeys(Keys.Tab);
                break;

            default:
                throw new Exception($"Key {keyboardActionType} is not defined in util");
            }
        }
Esempio n. 4
0
 public void SetKeyboardAction(KeyboardActionType type, Action callback)
 {
     int typeID = (int)type;
     if(keyboardActionDic.ContainsKey(typeID))
     {
         KeyboardAction action = keyboardActionDic[typeID];
         action.Callback = callback;
     }
 }