public static IWebDriver CheckEventIsAttached(this IWebDriver driver, IWebElement element, string eventName) { var javaScriptExecutor = driver as IJavaScriptExecutor; if (javaScriptExecutor == null) { throw new InvalidOperationException(driver.GetType() + " não implementa IJavaScriptExecutor"); } element.MatchCondition( e => { var id = element.GetAttribute("id"); return (bool)javaScriptExecutor .ExecuteScript("return $('#" + id + "').data('events')." + eventName + ".length > 0"); }, 15); return driver; }