Home > database >  Open chrome new tab in Selenium automated chrome
Open chrome new tab in Selenium automated chrome

Time:05-17

I'm creating a automated online banking balance check for my mother that's not really good at computer, I've stuck at the part that i want to open pdf file that already automated dowload in local pc then open in selenium automated chrome , is there anyway to do that , Thank you.

with normal webbrowser.open, it only open the chrome not the selenium automated chrome

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

CodePudding user response:

To handle a PDF document in Selenium test automation, we can use a java library called PDFBox

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();
    }
    }

For Python you can follow this link

  • Related