title: Downloading a pdf using RSelenium
body: <p>What I am trying to do with <code>RSelenium</code> package is,</p>
  
  <p>Step:1 Access a website - My own electric utility provider</p>
  
  <p>Step:2 Access my account by explicitly providing my username and password (That's the reason I am unable to share the code)</p>
  
  <p>Step:3 I click <strong><em>'VIEW MY BILL'</em></strong>.
  The bill is displayed in <strong>pdf</strong> format.</p>
  
  <p>Is there a way to download that file and save to specific folder?
  When I used <code>download.file()</code> command, it does not save the document, rather I get a 3KB pdf file that I am not able to open. Adobe Reader says that there is an error reading the document.</p>
  
  <p>Possible method that I tried:
  1. Right clicking, Pressing down arrow four times and then get to <strong>'SAVE PAGE AS'</strong> click Enter.</p>
  
  <p>But then it pops a dialog box asking for file name and location and I am not able to enter those details via RSelenium and save the file.</p>
  
  <p>Example code: Some random PDF found online.</p>
  
  <pre><code>url&lt;- "http://www.immigrationpolicy.org/sites/default/files/docs/how_us_immig_system_works.pdf"
  
  setwd("C:/Users/king/Desktop/bill")
  library(RSelenium)
  library(downloader)
  checkForServer()
  startServer()
  remDr &lt;- remoteDriver()
  remDr$open()
  remDr$navigate(url)
  </code></pre>