Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Java equivalent to PhantomJS? [closed]

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

like image 963
alextc Avatar asked Nov 03 '13 23:11

alextc


People also ask

What replaces PhantomJS?

Selenium, Electron, Protractor, wkhtmltopdf, and SlimerJS are the most popular alternatives and competitors to PhantomJS.

Is PhantomJS faster than Selenium?

Being a headless browser, the interactions are much faster than the real browser. So the performance time is smoother in PhantomJS than in Selenium.

Does Selenium support PhantomJS?

PhantomJS And Selenium For Web Automation (Basic) Just like any other browsers with GUI interface (Firefox, IE, Chrome, etc.), for PhantomJS also, Selenium has a standard API to support the automation.

Is PhantomJS headless browser?

PhantomJS is a discontinued headless browser used for automating web page interaction. PhantomJS provides a JavaScript API enabling automated navigation, screenshots, user behavior and assertions making it a common tool used to run browser-based unit tests in a headless system like a continuous integration environment.


2 Answers

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

like image 163
Benny Neugebauer Avatar answered Sep 18 '22 13:09

Benny Neugebauer


  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.

like image 32
LittlePanda Avatar answered Sep 21 '22 13:09

LittlePanda