Created
February 23, 2014 10:20
-
-
Save thekarel/9169612 to your computer and use it in GitHub Desktop.
Upload a file using Protractor -- From http://stackoverflow.com/questions/21305298/how-to-upload-file-in-angularjs-e2e-testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
it('should upload file', function() { | |
var fileToUpload = '../some/path/foo.txt'; | |
var absolutePath = path.resolve(__dirname, fileToUpload); | |
$('input[type="file"]').sendKeys(absolutePath); | |
$('#uploadButton').click(); | |
}); |
Somehow like this.
@ralucasuditu: #uploadButton, this is an ID which represents Upload button.
var path = require('path');
it('should upload file', function() {
var fileToUpload = '../some/path/foo.txt';
var absolutePath = path.resolve(__dirname, fileToUpload);
$('input[type="file"]').sendKeys(absolutePath);
$('#uploadButton').click();
});
what is __dirname ???
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi, what represents "#uploadButton"?