Skip to content

Instantly share code, notes, and snippets.

@seangeo
Created August 8, 2011 05:50
Show Gist options
  • Save seangeo/1131276 to your computer and use it in GitHub Desktop.
Save seangeo/1131276 to your computer and use it in GitHub Desktop.
Get Selenium to trigger jQuery change events on input in IE
// Add this to user_extensions.js
function withJQueryTriggers(proto, name) {
var original = proto[name];
proto[name] = function(locator, value) {
original.call(this, locator, value);
if (locator.indexOf("css=") == 0) {
var selector = locator.replace("css=", "");
LOG.info("triggering " + selector);
this.doRunScript("$(\"" + selector + "\").trigger('change');");
}
};
}
withJQueryTriggers(Selenium.prototype, "doType");
withJQueryTriggers(Selenium.prototype, "doSelect");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment