title: How do I set Chrome download directory with Selenium & VBA
body: <p>Using Win7, Office2010, Chrome 58, and Selenium 2.0.9, I'm automating the downloading of a number of files from a few websites (NB, I actually need the files and the sites are not mine - I'm <em>not</em> testing my own site), and I'd like to control where the files end up being downloaded.</p>
  
  <p>I have looked at quite a number of search results and everything I've found has led me to the following versions of code, each <code>Driver.SetPreference</code> variation has been tested independently and none of them work.</p>
  
  <pre><code>Private Sub DownloadDirTest()
  
    Dim Driver As Selenium.ChromeDriver
    Set Driver = New Selenium.ChromeDriver
  
    Driver.SetPreference "browser.download.dir", "\\server\share\my\long\path"
    Driver.SetPreference "browser.download.dir", "\\\\server\\share\\my\\long\path"
    'after mapping Y: to "\\server\share\my\long\path" in Windows Explorer
    Driver.SetPreference "browser.default_directory", "Y:\"
    Driver.SetPreference "browser.download.dir", "c:\"
    Driver.SetPreference "browser.default_directory", "c:\"
  
    Driver.Start "Chrome", "http://google.com"
  
    Driver.Close
  
  End Sub
  </code></pre>
  
  <p>As can been seen here:</p>
  
  <p><a href="https://i.stack.imgur.com/nWbhv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nWbhv.png" alt="enter image description here"></a></p>
  
  <p>Most of the references I've seen are for Python, Java or Ruby, and they all make reference to something like:</p>
  
  <pre><code>ChromeOptions options = new ChromeOptions();
  options.addArguments("user-data-dir=/path/to/your/custom/profile");
  </code></pre>
  
  <p>There doesn't seem to be any equivalent <code>ChromeOptions</code> available to VBA.</p>
  
  <p><strong>1)</strong> Does anyone know the actual property name to correctly set the download directory?</p>
  
  <p><strong>2)</strong> I'm not particularly wedded to Chrome, though it seems to be faster than <code>IEDriver</code> (in my initial testing), and I can't get the current Firefox driver to work. If someone has pointers to how to reliably set the DL directory in either of the other browsers (and a link to an updated Firefox driver - I haven't been able to find it via half-hearted searching), I'm open to using those.</p>