Commit edfade4b edfade4bc285a13c47f2f389001fb231db6e2e9b by Nicolas Perriault

better form submission in fill() by using events

1 parent 1cd41d0d
......@@ -740,6 +740,12 @@ Casper.prototype.fill = function fill(selector, vals, submit) {
var method = (form.getAttribute('method') || "GET").toUpperCase();
var action = form.getAttribute('action') || "unknown";
__utils__.log('submitting form to ' + action + ', HTTP ' + method, 'info');
var event = document.createEvent('Event');
event.initEvent('submit', true, true);
if (!form.dispatchEvent(event)) {
__utils__.log('unable to submit form', 'warning');
return;
}
if (typeof form.submit === "function") {
form.submit();
} else {
......