如何使用 Nightwatch 将图像上传到输入字段(目前仅上传文本)?
How can I upload an image to an input field with Nightwatch (currently only uploading text)?
如何使用 Nightwatch 将图像上传到输入字段?
我目前正在使用 setKeys()
,其中 Nightwatch 代码如下所示:
require('path').resolve(__dirname + '/nightwatch.jpg')
但是,这会导致上传文本 "nightwatch.jpg"
这是输入字段的样子:
<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);”>
啊!路径中的小错字。我忘了在路径前添加 ./
。
如何使用 Nightwatch 将图像上传到输入字段?
我目前正在使用 setKeys()
,其中 Nightwatch 代码如下所示:
require('path').resolve(__dirname + '/nightwatch.jpg')
但是,这会导致上传文本 "nightwatch.jpg"
这是输入字段的样子:
<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);”>
啊!路径中的小错字。我忘了在路径前添加 ./
。