Created
August 8, 2011 05:50
-
-
Save seangeo/1131276 to your computer and use it in GitHub Desktop.
Get Selenium to trigger jQuery change events on input in IE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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