简体   繁体   English

我想上传文档[img / txt / doc ...]

[英]I want to upload document [img /txt / doc…]

I am creating automation script ..i dont want to click on browse and upload button. 我正在创建自动化脚本..我不想单击浏览和上传按钮。 I want to set local file path and upload to server the doc. 我想设置本地文件路径并将其上传到服务器。

here is the code ...is there any script/code i can do that 这是代码...我可以执行任何脚本/代码吗

   <input id="ctl00_pagePlaceHolder_ajaxFU_file" type="file" name="ctl00$pagePlaceHolder$ajaxFU$file" class="fileupload" style="cursor:pointer;">
<a onclick="UploadFilectl00_pagePlaceHolder_ajaxFU(); return false;" id="ctl00_pagePlaceHolder_ajaxFU_visibleUploadButton" class="btn -blue -smaller" href="javascript:__doPostBack('ctl00$pagePlaceHolder$ajaxFU$visibleUploadButton','')" style="margin-left:4px;">Upload</a>
<input type="submit" name="ctl00$pagePlaceHolder$ajaxFU$hiddenUploadButton" value="" id="ctl00_pagePlaceHolder_ajaxFU_hiddenUploadButton" style="display:none;">

use selenium for automation and file uploading 使用硒进行自动化和文件上传

getttingstart 开始

you dont need to click on browser few steps will help you 您不需要单击浏览器,几个步骤可以帮助您

You cannot upload the file automatically - a user has to first select a file. 您无法自动上传文件-用户必须首先选择一个文件。

Otherwise it would be a security issue - imagine you visit a site and all of a sudden it starts uploading documents from your local hard disk without your knowledge. 否则,这将是一个安全问题-想象您访问了一个站点,突然间它开始在您不知情的情况下从本地硬盘上载文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM