chrome-reactive-kotlin

Maven Central Build Status Javadocs

chrome-reactive-kotlin is a low level Chrome DevTools Protocol client written in Kotlin and leveraging RxJava2 for easy composability.

Library exposes all protocol domains in a single, cohesive and highly composable API. It supports both headless and standalone Chrome versions and understands BrowserContext from Target domain.

For debugging purposes you can use my other project: chrome-protocol-proxy.

Please note that most up-to-date protocol is used at the moment.

Documentation can be found on https://wendigo.github.io/chrome-reactive-kotlin/.

Usage

Add to your Kotlin or Java project (Gradle dependency):

compile group: 'pl.wendigo', name: 'chrome-reactive-kotlin', version: '0.5.+'

Example

Run headless chrome:

docker container run -d -p 9222:9222 zenika/alpine-chrome --no-sandbox --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 about:blank

And now execute:

import pl.wendigo.chrome.api.page.NavigateRequest

fun main() {
    val browser = Browser.connect("127.0.0.1:9222")
    val session = browser.headlessSession("about:blank")

    await {
        session.Page.enable()
    }

    await {
        session.Page.navigate(NavigateRequest(url = "https://github.com/wendigo/chrome-reactive-kotlin")).flatMap { (frameId) ->
            session.Page.frameStoppedLoading().filter {
                it.frameId == frameId
            }.take(1).singleOrError()
        }
    }

    session.close()
    browser.close()
}
compile "pl.wendigo:chrome-reactive-kotlin:0.5.7"

Related Libraries

chrome-reactive-kotlin

Headless Chrome DevTools Protocol Client (RxJava2 + Kotlin)

Last updated 3 mins ago

vertx-lang-kotlin

Vert.x for Kotlin

Last updated 3 mins ago

kara

Kotlin Web Framework for the JVM

Last updated 3 mins ago

kraph

GraphQL request string builder written in Kotlin

Last updated 3 mins ago

tekniq

A framework designed around Kotlin providing a full-featured HTTP Framework, Restful HTTP Client, JDBC DSL, Loading Cache, Configurations, Validations, and more

Last updated 3 mins ago