Vaadin Upload File Path from Testing using Selenium

落爺英雄遲暮 提交于 2019-12-10 22:40:56

问题


Any reason why this wont set the file path for the Vaadin Upload Component in selenium.

The file path remains unset and when the click happens it trys to upload null. The file does exist in my local directory.

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

回答1:


This got it working

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


来源:https://stackoverflow.com/questions/35658831/vaadin-upload-file-path-from-testing-using-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!