Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Chrome Web Driver Automation with C# Selenium - Print to PDF or Save Web Page in PDF

On high level, I have to do web automation where in client's internal portal needs to be automate like click some buttons, links and finally a multi page pop will open and then I have to convert the pop into pdf file and save into network drive.

So far I have been able to automate login, able to click all the links per client requirement using leveraging C#, Selenium & Chrome Web Driver but I'm unable to convert final pop into pdf.

I have tried following options:-

  • iTextSharp - which is not working because it requires perfect HTML and if any of HTML tab is missing, it will throw an error. Also calling session based URL with iTextSharp will not because it would consider as new request to the portal.

  • WkHtmltoPDF - it's not allowed in client environment and same issue - calling session based URL with WkHtmltoPDF will not because it would consider as new request to the portal.

How can I automate something within Selenium & Chrome Web Driver using C# to convert multiple page HTML to .pdf?

Comments