Commit 837a0bcb 837a0bcb770ca38f4eb260b0c70b436999f9301d by Nicolas Perriault

added a check for Casper#fill 'selector' argument

1 parent de1a0348
...@@ -309,6 +309,9 @@ ...@@ -309,6 +309,9 @@
309 * @param Boolean submit Submit the form? 309 * @param Boolean submit Submit the form?
310 */ 310 */
311 fill: function(selector, vals, submit) { 311 fill: function(selector, vals, submit) {
312 if (typeof(selector) !== "string") {
313 throw "selector must be a string: " + selector;
314 }
312 if (!typeof(vals) === "object") { 315 if (!typeof(vals) === "object") {
313 throw "form values must be an object"; 316 throw "form values must be an object";
314 } 317 }
...@@ -331,7 +334,7 @@ ...@@ -331,7 +334,7 @@
331 })(this); 334 })(this);
332 } 335 }
333 // Form submission? 336 // Form submission?
334 if (submit === true) { 337 if ((submit||false) === true) {
335 this.evaluate(function() { 338 this.evaluate(function() {
336 var form = document.querySelector('%selector%'); 339 var form = document.querySelector('%selector%');
337 console.log('submitting form to ' + (form.getAttribute('action') || "unknown") 340 console.log('submitting form to ' + (form.getAttribute('action') || "unknown")
......