I want to test the image upload functionality using Protractor but my written script didn't work.
When we click on the dialogue box image it opens the window to select the desired image. After the selection of the image, the box acts like below:
I want to write a script through which I can upload an image and then click on the "Save" button.
Given below is the script that I tried but doesn't work:
var path = require('path'); var fileToUpload = '../new image.jpeg'; var absolutePath = path.resolve('__dirname', fileToUpload); console.log(absolutePath); var fileElem=element(by.css('label[for="cropper-file-input"]')); browser.wait(EC.presenceOf(fileElem), 2000,); fileElem.sendKeys(absolutePath);