【发布时间】:2022-01-25 05:42:59
【问题描述】:
我需要使用 Selenium Web 驱动程序和 Java 上传图像。 我尝试了以下方法:
- sendkeys() : 它不工作 [xpath used: //input[@id='brandingContent_AddImage']]
- 机器人类:仅在本地工作,但在远程和并行执行中停止工作。
- Sikuli :仅在测试执行屏幕处于焦点时工作。在并行执行中不起作用。
- AutoIT:尚未尝试。
需要一种能够成功上传图像并且可以并行执行的方式。 提前谢谢..!!
以下是 HTML 片段:HTML IMAGE
<div class="fileinput fileinput-new col-md-4 pl-1 " data-provides="fileinput"> <div class="w-100 float-left"> <div class="ctn_img_upload pull-left" id="uploadView_brandingContent_AddImage" xpath="1"> <div class="ad_file"> <span class="flaticon-plus"></span> <input type="hidden" value="" name=""><input autocomplete="off" type="button" data-minsize="300x600" data-c="" data-placeholder="brandingContent_AddImage" id="brandingContent_AddImage" class="browse-img fileupload-skin" onclick="brandingViewGenerator.uploadImage(event)" style="position: absolute;top: 0;left: -8px;right: 0;bottom: 0;width: 74px;height: 66px;"> <label class="fileupload-skin-label" for="editpanel_native_1" id="">Upload</label> </div> </div> <div class="edit-image" id="branding_image_preview_brandingContent_AddImage" style="display:none"> <img id="imageBlock_brandingContent_AddImage" src=""> <input class="delete1 bg-blue-flamingo" type="button" onclick="brandingViewGenerator.editImage(event)" id="edit_brandingContent_AddImage"> <input class="update bg-blue" type="button" id="upload_brandingContent_AddImage" data-minsize="300x600" onclick="brandingViewGenerator.uploadImage(event)"> </div> </div> <br clear="all"> <input type="hidden" name="centerStrech" value="center"> </div>
【问题讨论】:
标签: java selenium file-upload webdriver