All Projects → kklisura → Chrome Devtools Java Client

kklisura / Chrome Devtools Java Client

Licence: apache-2.0
Chrome DevTools java client.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Chrome Devtools Java Client

Rendora
dynamic server-side rendering using headless Chrome to effortlessly solve the SEO problem for modern javascript websites
Stars: ✭ 1,853 (+1431.4%)
Mutual labels:  chrome-devtools, chrome-headless
Rod
A Devtools driver for web automation and scraping
Stars: ✭ 1,392 (+1050.41%)
Mutual labels:  chrome-devtools, chrome-headless
Crrri
A Chrome Remote Interface written in R
Stars: ✭ 137 (+13.22%)
Mutual labels:  chrome-devtools, chrome-headless
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (+91.74%)
Mutual labels:  chrome-devtools, chrome-headless
Go Stare
A fast & light web screenshot without headless browser but Chrome DevTools Protocol!
Stars: ✭ 87 (-28.1%)
Mutual labels:  chrome-devtools, chrome-headless
chromic pdf
Convenient HTML to PDF/A rendering library for Elixir based on Chrome & Ghostscript
Stars: ✭ 196 (+61.98%)
Mutual labels:  chrome-devtools, chrome-headless
Crawlergo
A powerful dynamic crawler for web vulnerability scanners
Stars: ✭ 1,088 (+799.17%)
Mutual labels:  chrome-devtools
Go Chrome
A golang library for interacting with the Chrome DevTools Protocol. https://chromedevtools.github.io/devtools-protocol/
Stars: ✭ 96 (-20.66%)
Mutual labels:  chrome-devtools
V8 Javascript Memory
V8 JavaScript 内存占用分析
Stars: ✭ 46 (-61.98%)
Mutual labels:  chrome-devtools
Chrome Protocol Proxy
Chrome DevTools Protocol Proxy - intelligent proxy for debugging purposes
Stars: ✭ 94 (-22.31%)
Mutual labels:  chrome-devtools
Gowitness
🔍 gowitness - a golang, web screenshot utility using Chrome Headless
Stars: ✭ 996 (+723.14%)
Mutual labels:  chrome-headless
Wp Php Console
📟 Implementation of PHP Console for WordPress.
Stars: ✭ 91 (-24.79%)
Mutual labels:  chrome-devtools
Artemis Dev Tool
An Apollo GraphQL Query Schema Testing Tool
Stars: ✭ 66 (-45.45%)
Mutual labels:  chrome-devtools
Shopify Theme Inspector
A Chrome DevTools plugin that visualizes Shopify Liquid render profiling data so you can triage long-running code and reduce server response times!
Stars: ✭ 102 (-15.7%)
Mutual labels:  chrome-devtools
Chrome Devtools Autosave
Auto-saving CSS and JavaScript changes from the Chrome Developer Tools
Stars: ✭ 1,032 (+752.89%)
Mutual labels:  chrome-devtools
Lancia
网页转PDF渲染服务。提供收据、发票、报告或任何网页内容转PDF的微服务
Stars: ✭ 108 (-10.74%)
Mutual labels:  chrome-headless
Chart To Aws
Microservice to generate screenshot from a webpage and upload it to a AWS S3 Bucket.
Stars: ✭ 43 (-64.46%)
Mutual labels:  chrome-headless
Node Frontend
Node.js Docker image with all Puppeteer dependencies installed for frontend Chrome Headless testing and default Nginx config, for multi-stage Docker building
Stars: ✭ 104 (-14.05%)
Mutual labels:  chrome-headless
React Perftool
A browser developer tool extension, which will help you to inspect the performance of React Js components.
Stars: ✭ 90 (-25.62%)
Mutual labels:  chrome-devtools
Karmatic
🦑 Easy automatic (headless) browser testing with Jest's API, but powered by Karma & Webpack.
Stars: ✭ 1,178 (+873.55%)
Mutual labels:  chrome-headless

Chrome DevTools Java Client

Description

Chrome DevTools Java Client is a DevTools client - in Java. (: It can be used for instrumenting, inspecting, debuging and profiling Chromium, Chrome and other Blink-based browsers. [1]

For more information on DevTools, see https://chromedevtools.github.io/devtools-protocol/.

v1.3.6 tested on Google Chrome Version 67.0.3396.87. Protocol files from dev-tools-protocol#1aa7b31ca7

v2.1.0 tested on Google Chrome Version 76.0.3809.100. Protocol files from dev-tools-protocol#e1fb93bd76

v3.0.0 tested on Google Chrome Version 86.0.4240.111. Protocol files from dev-tools-protocol#fcb68d10bc

[1] https://chromedevtools.github.io/devtools-protocol/.

Usage

Add the following dependency to your pom.xml:

<dependency>
  <groupId>com.github.kklisura.cdt</groupId>
  <artifactId>cdt-java-client</artifactId>
  <version>3.0.0</version>
</dependency>

You can use following code, taken from, LogRequestsExample:

package com.github.kklisura.cdt.examples;

import com.github.kklisura.cdt.launch.ChromeLauncher;
import com.github.kklisura.cdt.protocol.commands.Network;
import com.github.kklisura.cdt.protocol.commands.Page;
import com.github.kklisura.cdt.services.ChromeDevToolsService;
import com.github.kklisura.cdt.services.ChromeService;
import com.github.kklisura.cdt.services.types.ChromeTab;

/**
 * Log requests example with DevTools java client.
 *
 * <p>The following example will open chrome, create a tab with about:blank url, subscribe to
 * requestWillBeSent event and then navigate to github.com.
 *
 * @author Kenan Klisura
 */
public class LogRequestsExample {
  public static void main(String[] args) {
    // Create chrome launcher.
    final ChromeLauncher launcher = new ChromeLauncher();

    // Launch chrome either as headless (true) or regular (false).
    final ChromeService chromeService = launcher.launch(false);

    // Create empty tab ie about:blank.
    final ChromeTab tab = chromeService.createTab();

    // Get DevTools service to this tab
    final ChromeDevToolsService devToolsService = chromeService.createDevToolsService(tab);

    // Get individual commands
    final Page page = devToolsService.getPage();
    final Network network = devToolsService.getNetwork();

    // Log requests with onRequestWillBeSent event handler.
    network.onRequestWillBeSent(
        event ->
            System.out.printf(
                "request: %s %s%s",
                event.getRequest().getMethod(),
                event.getRequest().getUrl(),
                System.lineSeparator()));

    network.onLoadingFinished(
        event -> {
          // Close the tab and close the browser when loading finishes.
          chromeService.closeTab(tab);
          launcher.close();
        });

    // Enable network events.
    network.enable();

    // Navigate to github.com.
    page.navigate("http://github.com");

    devToolsService.waitUntilClosed();
  }
}

For more examples, see examples.

Known-issues

API hangs (ie when printing PDFs)

What: If you're using cdt-java-client before version 2.1.0 for printing to PDF or using API which requests large amount of data, API may hang if the requesting data exceeds 4MB.

Why: This is due to underlying WebSocket library having 4MB buffer for receiving data from browser.

How to fix: With the version 2.1.0 and above, this buffer was increased to 8MB and can be further increased if necessary by setting the appropriate configuration property.

Debugging chrome

In order to debug chrome when using this library, set the logger com.github.kklisura.cdt.launch.chrome.output to DEBUG level. See ChromeLoggingExample for more information. Be sure to remove or turn the logger off, when done.

Running unit tests

make verify

Sonar analysis

make sonar-analysis

Download latest protocol

Run following:

make download-latest-protocol

This will download browser_protocol.json and js_protocol.json (protocol definitions) from https://github.com/ChromeDevTools/devtools-protocol repo.

Update protocol (generate Java files from protocol definitions)

Make sure you have correct or latest protocol definitions. See Download latest protocol on how to update protocol definitions to latest version.

Run following:

make update-protocol

This will build the tools for parsing and generating Java files, cdt-java-protocol-builder project. The input for this tool are protocol definitions files: browser_protocol.json and js_protocol.json. The generated Java files will be present in cdt-java-client project. After building Java files, the cdt-java-client will be compiled. If everything goes successfully, consider the protocol updated. :)

Updating copyright license header

To go over each module and each source java file to update copyright license header, run:

make update-copyright-license-header

License

Chrome DevTools Java Client is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].