Reputation: 9
I am trying to download the embedded pdf from the following page using RSelenium: https://rac.anpad.org.br/index.php/rac/article/view/1479/1672
# Access the web page (this works fine):
library(RSelenium)
driver <- rsDriver(browser = "firefox")
remote_driver <- driver[["client"]]
remote_driver$navigate("https://rac.anpad.org.br/index.php/rac/article/view/1479/1672")
# Download pdf (this is the part not working)
button <- remote_driver$findElement(using = "css selector", "span:nth-child(1)") # this seems to be working
button$clickElement() # but nothing happens here
But nothing happens, not even an error. Can someone tell me what is wrong? Is there a problem with the css selector? Or maybe with Firefox settings? I appreciate any help!! The best solution would include being able to set the file name to be downloaded.
Obs: I made a similar question here (How to download embedded PDF files from webpage using RSelenium?), but since I got stuck in the download step, I decided to post a simpler problem.
Upvotes: 0
Views: 551
Reputation: 3173
I was able to download the file by,
library(RSelenium)
driver <- rsDriver(browser = c("chrome"))
remDr <- driver$client
remDr$navigate("https://rac.anpad.org.br/index.php/rac/article/view/1479/1672")
remDr$findElement(using = "xpath",'/html/body/header/a[3]') -> downloadfile
downloadfile$clickElement()
Upvotes: 1