angularjs - Can't upload a file with protractor -


I have no luck with uploading a file with launcher. I just fill out a simple form and have a submit button, Which then needs to click the form post for a different URL:

  this can upload the file (, function () '{var fileToUpload =' .example.txt ', absolutePath = Path.resolve (__dirname, fileToUpload); file = element (by.css ('input [type =' file "] ')) element (by.css (' input [type = '" file "];' .)) Click () then (function () {console.log ('')) SendKeys (absoluteP Ath) element (by.css) clicked the button [type = "submit"] button ');});});  

The form is a markup here:

  & lt; Form enctype = "multipurpose / farm-data" method = "post" action = "/ upload" class = "upload ng-pristinet ng-valid" & gt; & Lt; Input type = "file" name = "file" class = "file" & gt; & Lt; Button type = "submit" value = "import" & gt; Upload & lt; / Button & gt; & Lt; / Form & gt;  

This test conducts that appears in the input and the submit button is clicked, but instead of posting the appropriate URL to the form:

< The pre- http: // localhost / uploads

appears to navigate to the url of Chrome but only says that "webpage is not available" in the test window. Manually submit the form, upload / upload to upload as candidates, and you have been given a confirmation message.

What I want to do, just waiting for the upload to upload the confirmation message and uploading for another test, but I can not get it yet What am I missing here?

Answer your own question here: when you have the wrong file path or name in the file input This "page not found" error being sent is that the proprietor will show any kind of useful message or hint instead of that there is no such file before submitting the form.

In my case I had the wrong directory of "../xample.txt" instead of "./example.txt", and it now works as expected.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -