Geiser
Geiser

Reputation: 1089

Blank page using PhantomJS 1.9.0, RSelenium in Ubuntu 14.04

I get a blank page when trying to navigate to any page, and I can't find any DOM element. I've tried with 2 different machines I already had, both of them Ubuntu 14.04 Server.

library("RSelenium")
pJS <- phantom()
nav <- remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName = "phantomjs")

nav$open()
nav$navigate("https://airenetworks.es/")
geco <- nav$findElement(using = "partial link text", value = "Oficina Virtual")
geco$clickElement()

The error in the last line of this code is:

Error:   Summary: NoSuchElement
     Detail: An element could not be located on the page using the given search parameters.
     class: SessionReqHand

Installed RSelenium via install.packages("RSelenium") and PhantomJS via apt-get install phantomjs. The demo("PhantomJSUserAgent") also fails.

If in this state I perform a nav$screenshot(display = TRUE) the image I get is all white. If you need the image data there it is:

iVBORw0KGgoAAAANSUhEUgAAAZAAAAEsCAYAAADtt+XCAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAehJREFUeJztwTEBAAAAwqD1T20ND6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4N1SVAAH5HdPnAAAAAElFTkSuQmCC

If you need more info, please ask. Thank you!

Upvotes: 1

Views: 320

Answers (1)

Geiser
Geiser

Reputation: 1089

I finally found that I had to code it as this it:

pJS <- phantom(extras = "--ignore-ssl-errors=true --ssl-protocol=tlsv1")
Sys.sleep(2)
nav <- remoteDriver(remoteServerAddr = "localhost", port = 4444, browserName = "phantomjs")

You have to set the protocol to tlsv1. Also important is to let it sleep for a second or two, because it takes time for it to start (After some trials and errors I realized that I needed the Sys.sleep(2) before calling the remoteDriver function)

Upvotes: 2

Related Questions