gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:54:48 26 4
gpt4 key购买 nike

为什么这不会在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com