Currently, I'm using Selenium Webdriver for c# and PDFBox to automate the PDF text of a report. Now, using PDFBox, we have the ability to parse a pdf given a URL link, with URL = new URL("link of pdf");. However, this takes the URL link directly without preconditions.

If I access the pdf that I'm trying to parse with the direct URL address, I get a resource not found error. I would need to log in to view the actual report, which is done using my Selenium code.

How would I link Selenium with PDFbox, so that instead of the code opening a new URL that goes directly to the Denied Permissions URL, it would go to the PDF Report that's already preloaded on the screen, with the same URL address?

The code I'm trying:

     URL url = new URL("link of url");
BufferedInputStream input = new  BufferedInputStream(url.openStream());
    PDFParser parsepdf = new PDFParser(input);
    textofpdf = new PDFTextStripper().getText(parsepdf.getPDDocument())

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.