我有这段代码:
File folder = new File("F:\\gals");
File[] listOfFiles = folder.listFiles();
这段代码返回文件夹 F:\gals 中所有文件的位置数组,我试图在 Selenium 代码中使用这些位置。
driver.findElement(By.id(id1)).sendKeys(listOfFiles[1]);
我看到错误信息。
The method sendKeys(CharSequence...) in the type WebElement is not applicable for the arguments (File)
我认为我需要将listOfFiles[]转换为字符串数组,请告诉我简单的方法。谢谢。