0

How can I upload an image to an input field using Nightwatch? I am currently using setKeys() where the Nightwatch code looks like:

require('path').resolve(__dirname + '/nightwatch.jpg')

However, this results in uploading the text "nightwatch.jpg"

This is what the input field looks like:

<input id="cc_action_image_upload" ng-show="true"
  class="btn btn-default btn-file ng-dirty ng-invalid ng-invalid-required next-value"
  ng-class="{'next-value': !nextValid.value || !nextValid.tab2}" type="file"
  ng-file select="onFileSelect($files, 'action_images/', 'action_creative.image')"
  ng-model="uploadFields.actionImage" accept="image/*" name="ls_action_image"
  shown-validation="" valid-file="" required="" style="background-color: rgb(255, 255, 255);”>
Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
Sua Morales
  • 894
  • 10
  • 21

1 Answers1

0

Ah! Small typo in path. I forgot to add ./ before path.

Sua Morales
  • 894
  • 10
  • 21