在Selenium自动镀铬中打开chrome新选项卡



我正在为我的母亲创建一个自动的网上银行余额检查,这不是很擅长计算机,我已经在我想打开pdf文件的部分,已经在本地电脑自动下载,然后在中打开selenium automated chrome有什么办法吗?谢谢。

使用正常的浏览器。打开,它只打开chrome而不是selenium automated chrome

import webbrowser
file_ = 'C:\Users\user\Downloads\MASTERCARD PLATINUM'+month_year+".pdf"
webbrowser.open_new_tab("https://www.google.com")

要在Selenium测试自动化中处理PDF文档,我们可以使用名为PDFBox的javalibrary

public void verifyContentInPDf() {
//specify the url of the pdf file
String url ="http://www.pdf995.com/samples/pdf.pdf";
driver.get(url);
try {
String pdfContent = readPdfContent(url);
Assert.assertTrue(pdfContent.contains("The Pdf995 Suite offers the following features"));
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

对于Python,您可以遵循

链接

最新更新