Submitting two forms sequentially with rvest

I am trying to use rvest to extract a csv file from this web page: http://www.voterfind.com/athensoh/vtrreport.aspx

I am wondering how to use rvest to submit two forms in a row. Pressing the "Start Processing" button in the first form leads to a second form with a button "Upload my file".

Here is the code I have so far resulted in a list instead of a dataset containing a csv file.

library(tidyverse)
library(rvest)`

`url <- "http://www.voterfind.com/athensoh/vtrreport.aspx"
pgsession <- html_session(url)
pgform <- html_form(pgsession)[[1]]
filled_form <- set_values(pgform, `grp_output` = TRUE)
athens <- submit_form(pgsession, filled_form)

      

Below is a snippet of the list. The above submit_form

led me to this list, which grabs some elements of the web page instead of the desired dataset contained in the csv file. This seems to indicate that I was unable to submit two forms in a row, from the page with the Start Processing button on the page using the Upload My File button.

List of 7
 $ handle  :List of 2
  ..$ handle:Class 'curl_handle' <externalptr> 
  ..$ url   : chr "http://www.voterfind.com/athensoh/vtrreport.aspx"
  ..- attr(*, "class")= chr "handle"
 $ config  :List of 7
  ..$ method    : NULL
  ..$ url       : NULL
  ..$ headers   : NULL
  ..$ fields    : NULL
  ..$ options   :List of 1
  .. ..$ autoreferer: int 1
  ..$ auth_token: NULL
  ..$ output    : NULL
  ..- attr(*, "class")= chr "request"
 $ url     : chr "http://www.voterfind.com/athensoh/underprocess.aspx"
 $ back    : chr(0) 
 $ forward : chr(0) 
 $ response:List of 10
  ..$ url        : chr "http://www.voterfind.com/athensoh/underprocess.aspx"
  ..$ status_code: int 200

      

Does anyone know how I can get to the csv file?

+3


source to share





All Articles