← Front page

Using PhantomJS With Robot Framework's Selenium2Library

UPDATE 2013-08-19: Selenium2 Library has now proper support for PhantomJS. http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html#Open%20Browser

Open Browser keyword in Selenium1Library used to support custom executable paths, but the same keyword in Selenium2Library does not. Luckily is does have remote_url parameter which we can utilize here.

Since 1.8 release PhantomJS comes with Ghost Driver, which is a JS implementation of WebDriver Wire Protocol. In order to start PhantomJS in remote WebDriver mode, you need to pass --webdriver argument to it:

phantomjs --webdriver=4444

Now we can use the remote_url argument to connect to PhantomJS, like this:

Open Browser    http://spage.fi    firefox    main browser    http://localhost:4444

Even though I specified firefox there, it is not used at all. Selenium2Library just want's to have some known browser in the browser argument.