0

我有这个自定义关键字,它等到文件下载然后删除文件,问题是在 chrome 中工作正常,但是当我在 firefox 中执行时出现错误。

    @Keyword
public verifyDownloadedFile2(String downloadPath, String fileName, timeOut) {
    int counter = 0
    boolean fileExist = new File(downloadPath + fileName).exists()
            
    while(!fileExist == true) {
        if(counter != timeOut) {
            WebUI.delay(1)
            fileExist = new File(downloadPath + fileName).exists()
            counter++
        }
        else if(counter == timeOut){
            throw new Exception("File was not downloaded within" + timeOut + " seconds.")
        }   
    }
    
    File dir = new File(downloadPath);
    File[] dirContents = dir.listFiles();

    if (dirContents.length > 0) {
        for (int i = 0; i < dirContents.length; i++) {
            dirContents[i].delete();
        }
    }
    
    assert fileExist == true
}

这是错误:

=============== 根本原因===================== 引起:org.codehaus.groovy.runtime.metaclass .MissingMethodExceptionNoStack:没有方法签名:windows.interactions.deleteFile2() 适用于参数类型:(java.lang.String, java.lang.String, java.lang.Integer) 值:[F:\Downloads\Katalon_Studio_Windows_64- 8.1.0\数据\温度,...]

4

0 回答 0