为什么这不会在 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();
关于java - 使用 Selenium 测试的 Vaadin 上传文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35658831/