The following html code is resposible for uploading file and element.send_keys(absfilepath)
does not work. after sending click
to element it opens up the fileupload window in the os (Linux in my case) and I couldn't interact with it.
Tested with Chrome, Firefox, PhantomJS no result with any of them.
<div class="col-sm-9">
<input value="" class="select-file-button" type="button">
</div>
which is attached to iQuery.ajaxFileUpload.js. Here is the result after file is uploaded manually:
<div class="col-sm-9">
<div class="ajax-fileupload" style="background-image: url("/Profishop/Temp/70a569b6747041bc88da3b74871afff7/Screenshot-2017-12-12%20Telegram%20Web.png");"><input type="button" class="delete-button"></div>
</div>
Also in the source code I found the input type="file"
element but it is called by a script and it not accessible in generated page.
<div class="col-sm-9">
<input type="file" class="afuProductImage" />
</div>
and this is the script
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
$(".afuProductImage").ajaxFileUpload({
uploadHandler: "/aja/upload?id=70a569b6747041bc88da3b74871afff7&op=upload",
deleteHandler: "/ajax/upload?op=deleteid=70a569b6747041bc88da3b74871afff7&name=",
filePath: null,
containerAttrs: {
class: "ajax-fileupload"
},
buttonAttrs: {
value: ""
},
});
});//]]>
</script>
Is there a way to upload the file using selenium by sending it a javascript command?