Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想编写一个脚本来填写表格并在 cucumber-js、selenium 和量角器中上传文件。每当我单击上传文件按钮时,都没有 xpath/id/etc... 可供单击。你如何处理文件上传?
顺便上传文件与 cucumberjs 无关。只需发送键输入type=file。还要确保文件路径是绝对的。所以一个纯 WebDriver 代码可能看起来像,
type=file
driver.findElement(wd.By.css('input[type=file]')).sendKeys('/absolute/path/to/my/file');