Problem uploading image with custom widget.

10 views
Skip to first unread message

Darko Raguž

unread,
Oct 3, 2016, 11:59:01 AM10/3/16
to CasperJS
The place I am trying to upload an image to is http://www.marktplaats.nl/
The page has a custom file upload widget that looks like this:


Once clicked, the browser displays a file chooser, and once a file is chosen, the upload automatically starts and you end up with this:


I tried accessing the underlying input element that looks like this:
<form id="syi-form" method="post" action="https://www.marktplaats.nl/syi/plaatsAdvertentie.html/m/save.html" novalidate="">
//a lot of stuff ommited
<input id="html5_1au5jf4tj1f7p13q8vko1hr511jlh" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;" multiple="" accept="image/jpeg,image/bmp,image/png" type="file">
//a lot of stuff ommited
</form>

by doing this:

var uplContainer0 =  x("//input[contains(@accept, 'imasge/jpeg')]"); 
...
.waitForSelector(uplContainer0)
 .then(function(){
        casper.page.uploadFile(uplContainer0,'imsg.png' );
    })


But my code fails silently, no error is shown, and no image is uploaded.
Can anyone help me?
Auto Generated Inline Image 1
Auto Generated Inline Image 2
Reply all
Reply to author
Forward
0 new messages