15

I would like to know whether there is any Java library equivalent to PhantomJS. What I want to achieve is to be able to simulate form login and submit actions from a web page and also to do page scraping as well. I know jsoup does page scraping but not page automation.

Thanks in advance!

Cheers, Alex

Martin of Hessle
  • 384
  • 3
  • 12
alextc
  • 2,829
  • 8
  • 52
  • 97

3 Answers3

8

There is a PhantomJS driver for Java called GhostDriver. Maybe this suits your requirements?

Benny Neugebauer
  • 46,191
  • 22
  • 218
  • 190
  • 1
    I found that GhostDrive hides many capabilities of PhantomJS. Like convert page to PDF for example. – ses Jun 26 '14 at 21:24
5
  1. Selenium with Ghostdriver/PhantomJS (This is good but there is an issue with automating file uploads for a website. Other automation activites work like a charm!)

  2. Selenium with HtmlUnitDriver. HtmlUnitDriver is based on HtmlUnit which is a GUI less implementation of a browser in Java. (I have had too many exceptions with HtmlUnitDriver)

  3. Jaunt - Their website is http://jaunt-api.com/. Their short description is:

    Jaunt Beta is a new, free, Java library for web-scraping & web-automation. The library provides an ultra-light headless browser (ie, no GUI). By using Jaunt your Java programs can easily perform browser-level, document-level, and DOM-level operations. Jaunt is the ideal tool when Javascript support is not required, for tasks including: filling out and submitting forms creating web-bots or web-scraping programs. interfacing with REST APIs or web-apps (HTML, XHTML or XML). automated testing.

Community
  • 1
  • 1
LittlePanda
  • 2,438
  • 1
  • 20
  • 33
  • 2
    Why not use just HtmlUnit? Jaunt is not the equivalent since it does not support JavaScript. – Alex78191 Apr 05 '18 at 01:28
  • It's not equivalent because it has an expiration system to force you to pay when you want to use it on the long term: https://jaunt-api.com/products.htm – gouessej Apr 10 '20 at 23:04
2

Here's a similar question and answer with a list of options for you. Not all are written in Java, but there may be some suitable options for you.

headless internet browser?

Community
  • 1
  • 1
SteveEdson
  • 2,425
  • 2
  • 25
  • 44