Javascript Selenium在拖放UI中上载隐藏文件

Javascript Selenium在拖放UI中上载隐藏文件,javascript,selenium-webdriver,Javascript,Selenium Webdriver,我正在尝试使用SeleniumWeb驱动程序在以下输入中添加图像 <input type="file" multiple="multiple" class="dz-hidden-input" accept="image/gif,image/jpg,image/jpeg,image/png,application/zip" style="visibility: hidden; position: absolute; top: 0px; left: 0px; height: 0px; widt

我正在尝试使用SeleniumWeb驱动程序在以下输入中添加图像

<input type="file" multiple="multiple" class="dz-hidden-input" accept="image/gif,image/jpg,image/jpeg,image/png,application/zip" style="visibility: hidden; position: absolute; top: 0px; left: 0px; height: 0px; width: 0px;">
启用可见性但发送密钥失败,出现相同错误

我发现了类似的问题,但我的元素从来都不可见

我尝试使用SeleniumIDE,它使用type命令

请让我知道,如果有人面临同样的问题,它是如何得到修复


提前感谢

尝试将输入元素的不透明度设置为1,然后使用SendKeys提供文件路径。可使用以下代码设置不透明度:

executor.executeScript("arguments[0].style.visibility='visible';",fileInput);
executor.executeScript("arguments[0].style.height='200px';",fileInput);   
executor.executeScript("arguments[0].style.width='200px';",fileInput);
然后执行sendKeys方法


如果有帮助的话,请告诉我

如果您在一个页面上的多个DropZone中针对dz隐藏输入时遇到问题,您应该执行以下操作:

  init: function() {
    this.hiddenFileInput.className = "dz-hidden-input dz-hidden-input-one";
  }

然后,您可以使用$(“.dz hidden input one”)

将隐藏的输入作为目标,我尝试了这个方法,但没有成功:INFO-Done:[执行脚本:arguments[0].style.opacity='1';[[[FirefoxDriver:firefox on LINUX(62D6989895-4ab1-4598-b552-425ea7c13e77)]->xpath://输入[@type='file'][1]]]INFO-执行:[发送密钥:50[[FirefoxDriver:firefox on LINUX(62d69895-4ab1-4598-b552-425ea7c13e77)->xpath://input[@type='file'][1]],[/data1/vishal/svn/9.0.0/automation/selenium/client/dataupload//content_library//images//nature.gif]])WARN-引发的异常org.openqa.selenium.ElementNotVisibleException:元素当前不可见,因此可能无法与之交互
  init: function() {
    this.hiddenFileInput.className = "dz-hidden-input dz-hidden-input-one";
  }