public void PresssKeyOnElementWith(KeyboardActionType keyName, SelectorPathType selector, string path) { var elementBy = WebElementUtils.GetElementAsBy(selector, path); var element = _driver.FindElement(elementBy); KeyboardUtils.EnterKeyToWebElement(element, keyName); }
public KeyboardData GetData(KeyboardActionType type) { int typeID = (int)type; if (!kvDic.ContainsKey(typeID)) { BaseLogger.LogFormat("No such keyboard type: {0}", type); } return kvDic[typeID]; }
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"); } }
public void SetKeyboardAction(KeyboardActionType type, Action callback) { int typeID = (int)type; if(keyboardActionDic.ContainsKey(typeID)) { KeyboardAction action = keyboardActionDic[typeID]; action.Callback = callback; } }