public Dictionary <string, object> GetAttributes(JScriptType jScriptType, IWebDriver webDriver, IWebElement webElement) { IJavaScriptExecutor js = (IJavaScriptExecutor)webDriver; Dictionary <string, Object> Attribute = new Dictionary <string, object>(); Attribute = (Dictionary <string, Object>)js.ExecuteScript(jScriptType.GetDescription(), webElement); return(Attribute); }
public object ExecuteScript(JScriptType jScriptType, IWebDriver webDriver, IWebElement webElement) { try { return(((IJavaScriptExecutor)webDriver).ExecuteScript(jScriptType.GetDescription(), webElement)); } catch (InvalidOperationException ObjInvalidOperationException) { Logger.Error("WaitTillAjaxLoad threw InvalidOperationException with message '{0}'", ObjInvalidOperationException.Message); return(null); } catch (WebDriverTimeoutException ObjWebDriverTimeoutException) { Logger.Error(String.Format("Error: Exception thrown while running JS Script:{0}{1}{2}", Environment.NewLine, jScriptType.GetDescription(), ObjWebDriverTimeoutException.Message)); return(null); } catch (Exception ObjException) { Logger.Error(String.Format("Error: Exception thrown while running JS Script:{0}", Environment.NewLine, ObjException.Message)); return(null); } }