How to download protected PDF (ViewDocument) using Selenium or requests? #3914
              
                
                  
                  
                    Answered
                  
                  by
                    mdmintz
                  
              
          
                  
                    
                      Daremitsu1
                    
                  
                
                  asked this question in
                Q&A
              
            -
| I'm trying to download a protected PDF from the New York State Courts NYSCEF website using Python. The URL looks like this: 
 
 Here’s what I’ve tried: Using  And using SeleniumBase: Nothing works. Full code for reference: Response:  | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            mdmintz
          
      
      
        Aug 4, 2025 
      
    
    Replies: 1 comment 1 reply
-
| This downloads that file into the  from seleniumbase import SB
with SB(uc=True, test=True, external_pdf=True) as sb:
    url = "https://iapps.courts.state.ny.us/nyscef/ViewDocument?docIndex=cdHe_PLUS_DaUdFKcTLzBtSo6zw=="
    sb.activate_cdp_mode(url)
    sb.sleep(10) | 
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
      Answer selected by
        mdmintz
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
This downloads that file into the
./downloaded_files/folder: