3

Using the RSelenium package, I'm trying to right click a link to download a file.

My application requires me to provide a log in with a password, which works fine, but this simple application demonstrates my current obstacle.

Consider this attempt to download an excel file of football rankings.

library(RSelenium)
RSelenium::checkForServer()
RSelenium::startServer()

remDr <- remoteDriver(browserName = "phantomjs")

remDr$open()

remDr$navigate("http://www.fantasypros.com/nfl/rankings/wr.php")


xls_link <- remDr$findElement("css selector", 
                              "#export-xls")

Next I hover the mouse over the link I need to download

remDr$mouseMoveToLocation(webElement = xls_link)

When I take a screen shot it's apparent that the code has worked thus far (that is, the link is underlined)

enter image description here

Why doesn't the following:

remDr$click(1)

Download the file?

tomw
  • 3,114
  • 4
  • 29
  • 51

1 Answers1

0

I've been struggling with something similar and it seems it is not a Selenium issue but a PhantomJS one. Apparently, it's kinda hard to download files with PhantomJs. See here and here. Perhaps you can simply use Firefox and it will download the file to the default Downloads folder.

Community
  • 1
  • 1
elikesprogramming
  • 2,506
  • 2
  • 19
  • 37