我的任务是单击“生成pdf”,然后自动生成pdf,以查看数据是否按预期显示。但是,我无法选择最后生成的pdf。。。。它只需要第一个pdf文件。每次单击“生成pdf”时,都会生成文件------->示例:(“file:///home/tifoso/downloads/search by criteria.pdf”),(“file:///home/tifoso/downloads/search by criteria(1.pdf)”等)
到目前为止我的代码是:
public void readPDF_ProvidersList() throws IOException {
System.out.println("_______Testing PDF file_______");
URL url = new URL("file:///home/tifoso/Downloads/Provider List.pdf");
InputStream is = url.openStream();
BufferedInputStream fileParse = new BufferedInputStream(is);
PDDocument document = null;
document = PDDocument.load(fileParse);
String pdfContent = new PDFTextStripper().getText(document);
System.out.print(pdfContent);
Assert.assertTrue(pdfContent.contains("License/Provider"));
Assert.assertTrue(pdfContent.contains("Address"));
Assert.assertTrue(pdfContent.contains("Phone"));
Assert.assertTrue(pdfContent.contains("Email"));
Assert.assertTrue(pdfContent.contains("Gender"));
Assert.assertTrue(pdfContent.contains("Ethnicity"));
Assert.assertTrue(pdfContent.contains("Highly"));
Assert.assertTrue(pdfContent.contains("Recommended"));
Assert.assertTrue(pdfContent.contains("Metro"));
}
如何在代码中指定希望系统使用最新生成的pdf?它是动态的,每次单击“生成pdf”时都会更改
暂无答案!
目前还没有任何答案,快来回答吧!