Commit 1456d23e 1456d23e1df2bac003792760c33362f2eb9c48c2 by Nicolas Perriault

fixed #389 - check that uploaded file path exists

1 parent 41d61fdb
...@@ -731,6 +731,9 @@ Casper.prototype.fill = function fill(selector, vals, submit) { ...@@ -731,6 +731,9 @@ Casper.prototype.fill = function fill(selector, vals, submit) {
731 } else { 731 } else {
732 (function _each(self) { 732 (function _each(self) {
733 fillResults.files.forEach(function _forEach(file) { 733 fillResults.files.forEach(function _forEach(file) {
734 if (!fs.exists(file.path)) {
735 throw new CasperError('Cannot upload unexistent file: ' + file.path);
736 }
734 var fileFieldSelector = [selector, 'input[name="' + file.name + '"]'].join(' '); 737 var fileFieldSelector = [selector, 'input[name="' + file.name + '"]'].join(' ');
735 self.page.uploadFile(fileFieldSelector, file.path); 738 self.page.uploadFile(fileFieldSelector, file.path);
736 }); 739 });
......