fixed #389 - check that uploaded file path exists
Showing
1 changed file
with
3 additions
and
0 deletions
... | @@ -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 | }); | ... | ... |
-
Please register or sign in to post a comment