Reputation: 21
I'm trying to extract information on pricing of large healthcare databases on an ASPX web page that uses __doPostBack. I'm specifically interested in the prices of State Databases (not the default nationwide databases). I am trying to use rvest within R.
The particular pricing page is located at: https://www.distributor.hcup-us.ahrq.gov/Databases.aspx
I've tried to use existing solutions on stackoverflow (see code below) and I am probably missing something basic.
sesh<-html_session("https://www.distributor.hcup-us.ahrq.gov/Databases.aspx")
form<-html_form(sesh)[[1]]
query<-list(`lng`="en-US",
`__VIEWSTATEGENERATOR`=form$fields$`__VIEWSTATEGENERATOR`$value,
`__VIEWSTATE`=form$fields$`__VIEWSTATE`$value,
`__EVENTTARGET`="p$lt$SubContentHome$PlaceHolderHome$p$lt$zoneMain$ProductGridSearch$ddlCategory",
`__EVENTARGUMENT`="State")
page<-rvest:::request_POST(sesh,"https://www.distributor.hcup-us.ahrq.gov/Databases.aspx",
body=query,encode="form")
page<-read_html(page)
tbls <- html_nodes(page, "table")
head(html_table(tbls[[6]],fill=T,header=T),10)[,2]
I expected the output to show the names of the statewide databases, but instead it lists the names of the nationwide databases that are shown by default when you navigate to the page.
Upvotes: 2
Views: 140