geotheory
geotheory

Reputation: 23670

RSelenium - downloading a file with phantom.js

Using RSelenium I can download a file from a webpage using a connection via a Firefox browser with the following formula:

csv = remDr$findElement(using = 'css selector', "a[ng-click*=download]")
remDr$executeScript("arguments[0].click();", list(csv))

When I try to replicate the process with phantomjs browser nothing happens. Guessing maybe no download directory is set, I've tried:

remDr$extraCapabilities = makeFirefoxProfile(list(browser.download.dir = "/download/path"))

Still nothing happens. Grateful for an idea what needs to happen to get this to work.


Edit.

I should add the following report during setup, which may or may not be relevant, although it doesn't appear to stop the page connection or element selection:

> pJS = phantom()
[ERROR - 2016-03-17T17:54:08.914Z] GhostDriver - main.fail - {"line":85,"sourceURL":"phantomjs://code/main.js","stack":"global code@phantomjs://code/main.js:85:56"}

  phantomjs://platform/console++.js:263 in error

Upvotes: 4

Views: 1595

Answers (2)

geotheory
geotheory

Reputation: 23670

Hmm it seems phanrom.js doesn't support file download.

Upvotes: 0

Noe Lopez
Noe Lopez

Reputation: 305

phantomjs://platform/console++.js:263 in error

This error commonly happens when you run selenium server and phantomjs in the same port

Upvotes: 5

Related Questions