What I am trying to do with RSelenium
package is,
Step:1 Access a website - My own electric utility provider
Step:2 Access my account by explicitly providing my username and password (That's the reason I am unable to share the code)
Step:3 I click 'VIEW MY BILL'. The bill is displayed in pdf format.
Is there a way to download that file and save to specific folder?
When I used download.file()
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.
Possible method that I tried: 1. Right clicking, Pressing down arrow four times and then get to 'SAVE PAGE AS' click Enter.
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.
Example code: Some random PDF found online.
url<- "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 <- remoteDriver()
remDr$open()
remDr$navigate(url)