TestProject Forum

Set Driver Desired Capabilities To Download PDF Files Instead Of Opening Them On Browser

Is it possible to set driver desired capabilities on test project to automatically download all PDF instead of opening them on browser? I can manually disable the PDF action in browser settings so it will be downloaded instead of opening in browser. But when I execute new job, the previous browser settings is being reset to default, meaning, again I have to change the settings? Is there any other possible way?

Hi @Kakarot,
You can add these capabilities in the job capabilities to download pdf instead of opening in pdf viewer.

Please let me know if this solved your issue.
Kind regards
Tal

@Tal.Efraim Yes, thanks a lot man. This solved the issue. Now it’s downloading PDF files instead of opening. Also need more documentation on set driver desired capabilities section. Just a suggestion, a blog maybe?

@Tal.Efraim Also is there any way to set driver desired capabilities for giving a default download path? For eg, download-path: /home/user/pdfdir/

Hi @Kakarot,
You can add this to your capabilities to give default download path.

Kind regards
Tal

@Tal.Efraim It’s working perfectly. All issues solved. Now I can download files in the given directory. Thanks a lot bruh! Also need more information on set driver desired capabilities so it will be helpful to everyone since we can configure the browser like we did on good ol selenium manual testing.