3

In the past I have used selenium 2 and phantomJS with python and there seems to be alot of support out there for that. However I would now like to try this combo using java, has anyone tried this? do I need to use ghostdriver?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Calum
  • 2,110
  • 2
  • 22
  • 39

1 Answers1

4

The Java binding for GhostDriver is PhantomJSDriver & that class, plus GhostDriver itself is now part of PhantomJS core as of the 1.9 release. So if you grab that binary (or build from source), you'll already have GhostDriver available.

Also, since GhostDriver extends RemoteWebDriver, you could use it via that class directly instead by passing in a URL, if you don't want to use the custom binding.

We've recently switched over to using PhantomJSDriver in our tests & it was as simple as changing one class & having phantomjs available on the classpath. Taking screenshots too without issue.

You can get more info on the Github page for Ghostdriver here. The BaseTest class on the Github repo also gives a good starter for what options you may want to configure for the driver's capabilties (e.g. sensible default SSL settings).

anotherdave
  • 6,656
  • 4
  • 34
  • 65
  • thanks for that, I worked out that it was built into phantomJS but now am having issues with not detecting phantomJSDriver, see http://stackoverflow.com/questions/18243309/getting-selenium-ghostdriver-phantomjs-working-on-windows-7 – Calum Aug 14 '13 at 22:36
  • It sounds like a path issue alright, though I'm not used to developing on Windows. How are you including the classes in your project, via Maven/Gradle or adding to the classpath? – anotherdave Aug 15 '13 at 07:39