cdp4j - Chrome DevTools Protocol for Java

cdp4j

cdp4j is a Java library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol. It can be used for automating the use of web pages and for testing web pages. cdp4j runs full by default, but can be configured to run headless Chrome or Chromium.

What can i do

Most things that you can do manually in the browser can be done using cdp4j. Here are a few examples to get you started:

  • Generate screenshots and PDFs of pages.
  • Crawl a Single-Page Application and generate pre-rendered content (Server-Side Rendering).
  • Automate form submission, UI testing, keyboard input, etc.
  • Create an up-to-date, automated testing environment.
  • Run your tests directly in the latest version of Chromium using the latest JavaScript and browser features.

Features

  • Supports full capabilities of the Chrome DevTools Protocol (tip-of-tree)
  • Evaluate JavaScript
  • Invoke JavaScript function
  • Supports native CSS selector engine
  • Supports Sizzle selector engine
  • Supports XPath queries
  • Incognito Browsing (private tab)
  • Full page screen capture
  • Trigger Mouse events (click etc...)
  • Send keys (text, tab, enter etc...)
  • Redirect log entries (javascript, network, storage etc...) from browser to slf4j
  • Intercept Network (request & response)
  • Upload file programmatically without third party solutions (does not requires AWT Robot etc...)
  • get & set Element properties
  • Supports Headless Chrome/Chromium
  • Navigate back, forward, stop, reload
  • clear cache, clear cookies, list cookies
  • set & get values of form elements
  • Supports event handling

Feature Additions

We can add additional features that you may need which are not currently offered in our products on a contract or co-development basis.

Supported Java Versions

Oracle & OpenJDK Java 8 & 11.

Both the JRE and the JDK are suitable for use with this library.

Supported Platforms

Windows, Linux and macOS.

Design Principles

We focuses on providing lightweight and robust solution with an emphasis on speed, size, portability, features, and standards compliance.

Here are key design principles of cdp4j:

  • Avoid external dependencies as much as possible.
  • Support only Chrome/Chromium based browsers.
  • Supports full capabilities of the Chrome DevTools Protocol.
  • Keep the API simple.

Licensing

cdp4j is licensed as Commercial License. Buying a license is mandatory as soon as you develop commercial activities distributing the cdp4j software inside your product or deploying it on a network.

Download & Source Code

Please visit our GitHub page to download cdp4j source code.

Code Samples

Code samples page contains the source code of examples that demonstrate features you can implement using cdp4j library.