title: Rselenium command for "save link as"
body: <p>(warning, Newbie, slowly learning R)</p>
  
  <p>Hi There, </p>
  
  <p>I'm trying to download data automatically from a website using R. The website is using sharepoint and after asking (<a href="https://stackoverflow.com/questions/33655264/r-download-from-aspx-in-https-getting-website-instead-of-csv/33683635#33683635">R download from aspx in https getting website instead of CSV</a>) someone pointed me to RSelenium.</p>
  
  <p>What I need is to download csv files from addresses like this:
  <a href="https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Production/ProductionByCountyExport.aspx?UNCONVENTIONAL_ONLY=false&amp;INC_HOME_USE_WELLS=true&amp;INC_NON_PRODUCING_WELLS=true&amp;PERIOD=15AUGU&amp;COUNTY=ALLEGHENY" rel="nofollow noreferrer">https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Production/ProductionByCountyExport.aspx?UNCONVENTIONAL_ONLY=false&amp;INC_HOME_USE_WELLS=true&amp;INC_NON_PRODUCING_WELLS=true&amp;PERIOD=15AUGU&amp;COUNTY=ALLEGHENY</a></p>
  
  <p>But before I need to accept an agreement (a "click" I am doing with RSelenium) Code here:</p>
  
  <pre><code># Using RSelenium to save file
  ##Installing the package if needed
  install.packages("RSelenium")
  ##Activating 
  library("RSelenium")
  checkForServer()
  startServer()
  #I had to start the server manually!
  remDr &lt;- remoteDriver()
  remDr
  remDr$open()
  #open website and accepting conditions
  remDr$navigate("https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Welcome/Agreement.aspx")
  AgreeButton&lt;-remDr$findElement(using = 'id', value="MainContent_AgreeButton")
  AgreeButton$highlightElement()
  AgreeButton$clickElement()
  
  remDr$navigate("https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Production/ProductionByCountyExport.aspx?UNCONVENTIONAL_ONLY=false&amp;INC_HOME_USE_WELLS=true&amp;INC_NON_PRODUCING_WELLS=true&amp;PERIOD=15AUGU&amp;COUNTY=ALLEGHENY")
  </code></pre>
  
  <p>My problem is:
  that I can not find the command in RSelenium for "save link as"</p>
  
  <p>I figured that I need to find something of this type:</p>
  
  <pre><code>CSVurl&lt;-remDr$navigate ("https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Production/ProductionByCountyExport.aspx?UNCONVENTIONAL_ONLY=false&amp;INC_HOME_USE_WELLS=true&amp;INC_NON_PRODUCING_WELLS=true&amp;PERIOD=15AUGU&amp;COUNTY=ALLEGHENY")remDr$navigate("https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Production/ProductionByCountyExport.aspx?UNCONVENTIONAL_ONLY=false&amp;INC_HOME_USE_WELLS=true&amp;INC_NON_PRODUCING_WELLS=true&amp;PERIOD=15AUGU&amp;COUNTY=ALLEGHENY")
  
  CSVurl$saveLinkAs(fileName)
  </code></pre>
  
  <p>Does this exist?
  Are there better ways to do this in R?</p>
  
  <p>Thanks in advance</p>