Skip to content

furstenheim/remote-dom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remote DOM

The aim of this library is to allow (almost) seamless interaction with the DOM through the debugging protocol. It is under development, but it is already capable of the following (take a look at example/example.js)

  const remoteDom = require('remote-dom')
  const client = someChromeDebuggingClient
  async function doSomethingOnTheWeb () {
    const {window, document} = await remoteDom.env(client)
    const linkElement = await document.querySelectorAll('a')
    const html = await linkElement.outerHTML
  }
  

Motivation

Migrating chrome extensions to work in Chrome Headless.

A nice feature of Chrome Extensions is that they are provided with a different js environment as the webpage and access to the DOM. Although Chrome Headless has no plans of supporting extensions, it is possible to access the DOM through the protocol. This library abstracts that protocol so that the interface is the same as the usual DOM manipulation. Only caveat is that all iteractions are async so they return a promise that resolves in the requested value.

Useful links

Credit

This project is heavily inspired on jsdom

About

Access the dom through the debugging protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published