Headless Browser Save

Headless/full Java browser with support for downloading files, working with cookies, retrieving HTML and simulating real user input. Possible via Node.js with Puppeteer and/or Playwright. Main focus on ease of use and high-level methods.

Project README

HBrowser

Headless/full Java browser with support for downloading files, working with cookies, retrieving HTML and simulating real user input. Possible via Node.js with Puppeteer and/or Playwright. Main focus on ease of use and high-level methods. Add this to your project with Maven/Gradle/Sbt/Leinigen (Java 8 or higher required).

HBrowser browser = new HBrowser();
try(PlaywrightWindow window = browser.openWindow()){
    window.load("https://example.com");
   // ...   
}

All examples here. Note that the first run may take a bit because Node.js and its modules get installed into your current working dir under ./headless-browser.

Features

  • High-Level methods for...
    • downloading files.
    • working with cookies.
    • retrieving HTML.
    • simulating real user input.
  • Integrated evasions for headless detection:
HBrowser b = new HBrowser();
try (PlaywrightWindow w = b.openCustomWindow()
    .headless(true).makeUndetectable(true).buildPlaywrightWindow())
{
   w.load("https://infosimples.github.io/detect-headless/");
   w.makeScreenshot(new File("screenshot.png"), true);
} 
catch (Exception e) {e.printStackTrace();}
  • Easy access to Node.js from within Java:
new NodeContext().executeJavaScript("console.log('Hello!');");
  • HTML handling via Jsoup and JSON with Gson.

Drivers

Playwright is the default and recommended browser driver to use, since it supports downloads and more of its features were ported to Java. Checkout JG-Browser for a browser completely written in Java.

Name Version JS-Engine Downloads
Playwright Latest Node.js/V8 Yes
Puppeteer Latest Node.js/V8 No

(JS = JavaScript; Downloads = If the browser is able to download files other than html/xml/pdf;)

Contribute/Build

Beginners

If you have never contributed before, we recommend this Beginners Article. If you are planning to make big changes, create an issue first, where you explain what you want to do. Thank you in advance for every contribution! If you don't know how to import a GitHub project, check out this guide: IntelliJ IDEA Cloning Guide

Build-Details

Libraries

Name/Link Usage License
Playwright Emulates different types of browsers License
Puppeteer Emulates different types of browsers License
Node.js Enables executing JavaScript code License
Jsoup Used to load pages and modify their HTML code License
Open Source Agenda is not affiliated with "Headless Browser" Project. README Source: Osiris-Team/HBrowser
Stars
113
Open Issues
0
Last Commit
3 months ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating