Skip to content

How to download a PDF file with a link that show up in your browser as a PDF? #98

Closed Answered by GCuser99
GHRyunosuke asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @GHRyunosuke, did you set the download preferences before navigating to the pdf url?
If the new way (experimental) below does not work for you, then comment it out and try the old way:

Sub test_file_download2()
    'WARNING - this currently will fail in Edge/Chrome if running in Incognito mode 
    'see https://github.com/GCuser99/SeleniumVBA/issues/87 for work-around(s)
    Dim driver As WebDriver
 
    Set driver = New WebDriver
    driver.StartChrome
    
    'set the directory path for saving download to
    Dim caps As WebCapabilities
    Set caps = driver.CreateCapabilities
    caps.SetDownloadPrefs ".\"
    driver.OpenBrowser caps
    
    'delete legacy copy if it exists
    dr…

Replies: 10 comments 7 replies

Comment options

You must be logged in to vote
2 replies
@GHRyunosuke
Comment options

@GHRyunosuke
Comment options

Answer selected by GHRyunosuke
Comment options

You must be logged in to vote
1 reply
@GHRyunosuke
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@GHRyunosuke
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@GHRyunosuke
Comment options

Comment options

You must be logged in to vote
1 reply
@GHRyunosuke
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@GHRyunosuke
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants