file upload in nightwatch.js which uses dropzone

433 views
Skip to first unread message

Sabin Bhandari

unread,
Jun 23, 2017, 12:37:43 PM6/23/17
to NightwatchJs
Hello,

#issue 1: 
while working with the nightwatch.js, I tried to test the upload of the file. When I used the commands .setValue('//input[@type="file"]', require('path').resolve(__dirname + '/kinetic.stl')), it should have uploaded the file, but it doesn't. The idea is that a div is used to create a dropzone. If the dropzone is clicked then a dialog box appears and we can select the file from there. I assumed that there is an hidden input field, which I found far below the closing tag of the div.



#issue 2:

I am using xquery selector and I tried to set value of the input field in the iframe but all in vain.

   `.frame('someid')
    .setValue('//input[contains(@name,"project name")]', 'Nightwatch Project')
    .pause(5000)
    .frame(null)`

It says unable to locate element: "//input[contains(@name,"project name")]" using: xpath


Can you help me with these issues?

sincerely,
sabin bhandari


davidlinse

unread,
Jun 26, 2017, 6:34:08 AM6/26/17
to NightwatchJs
are you sure, the frame was switches as expected ?
you could/should add the optional callback to you `frame(..)` command
and inspect/assert the result. Further you should make sure that
the element in question is available via the appropriate commands.

regards

Reply all
Reply to author
Forward
0 new messages