[英]Selenium won't open a new URL in a new tab (Python & Chrome)
[英]Open chrome new tab in Selenium automated chrome
我正在为我的母亲创建一个不太擅长计算机的自动网上银行余额检查,我一直坚持我想打开已经在本地 pc 中自动下载的 pdf 文件然后在selenium 自动 chrome中打开的部分,有吗无论如何都要这样做,谢谢。
使用普通的 webbrowser.open,它只打开 chrome 而不是selenium 自动 chrome
import webbrowser
file_ = 'C:\\Users\\user\\Downloads\\MASTERCARD PLATINUM'+month_year+".pdf"
webbrowser.open_new_tab("https://www.google.com")
要在 Selenium 测试自动化中处理 PDF 文档,我们可以使用一个名为PDFBox
的 java library
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,您可以点击此链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.