使用 Selenium 测试的 Vaadin 上传文件路径

Vaadin Upload File Path from Testing using Selenium

这不会在 selenium 中设置 Vaadin 上传组件的文件路径的任何原因。

文件路径仍未设置,当点击发生时,它会尝试上传 null。该文件确实存在于我的本地目录中。

$(UploadElement.class).first().findElement(By.className("gwt-FileUpload")).sendKeys("/tmp/test.xlsx");
$(UploadElement.class).first().findElement(By.className("v-button")).click();

这成功了

getDriver().findElement(By.xpath("//input[@type='file']")).sendKeys("/tmp/test.xlsx"); 
$(UploadElement.class).first().findElement(By.className("v-button")).click();