Coder Social home page Coder Social logo

geekwolverine / chrome-reactive-kotlin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wendigo/chrome-reactive-kotlin

0.0 1.0 0.0 100.36 MB

Headless Chrome DevTools Protocol Client (RxJava3 + Kotlin)

License: Apache License 2.0

Shell 0.16% Groovy 0.28% Go 1.05% Kotlin 97.89% Handlebars 0.62%

chrome-reactive-kotlin's Introduction

chrome-reactive-kotlin v0.7.1

Maven Central Javadocs Tests Update Status Dependabot Status

chrome-reactive-kotlin is a low level Chrome DevTools Protocol client written in Kotlin and leveraging RxJava3 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 supports creating isolated environments via BrowserContext from Target domain and flatted sessions mode (see: http://crbug.com/991325).

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

Gradle

build.gradle:

implementation 'pl.wendigo:chrome-reactive-kotlin:0.7.1'

build.gradle.kts:

implementation("pl.wendigo:chrome-reactive-kotlin:0.7.1")

Maven

pom.xml:

<dependency>
  <groupId>pl.wendigo</groupId>
  <artifactId>chrome-reactive-kotlin</artifactId>
  <version>0.7.1</version>
</dependency>

Example

Run headless chrome:

docker container run -d -p 9222:9222 eu.gcr.io/zenika-hub/alpine-chrome:89 --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 chrome = Browser.builder()
        .withAddress("127.0.0.1:9222")
        .build()

    chrome.use { browser ->
        browser.target("about:blank").use { target ->
            await {
                target.Page.enable()
            }

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

chrome-reactive-kotlin's People

Contributors

bai-jie avatar dependabot-preview[bot] avatar wendigo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.