Coder Social home page Coder Social logo

bwalderman / bidiinchromecontext Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sadym-chromium/bidiinchromecontext

0.0 0.0 0.0 92 KB

experiments with running BiDi-CDP mapper in Chrome tab

License: Apache License 2.0

JavaScript 12.77% Python 43.81% TypeScript 43.42%

bidiinchromecontext's Introduction

WebDriver BiDi for Chromium Prototype

This is an experimental prototype of the WebDriver BiDi protocol for Chromium, implemented as a JavaScript layer translating between BiDi and CDP run in Chrome Tab.

Setup

This is a Node.js project, so install dependencies as usual:

npm install

Then set the BROWSER_PATH environment variable to a Chrome, Edge or Chromium binary to launch. For example, on macOS:

export BROWSER_PATH="/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
export BROWSER_PATH="/Applications/Microsoft Edge Canary.app/Contents/MacOS/Microsoft Edge Canary"
export BROWSER_PATH="example/path/to/Chromium.app/Contents/MacOS/Chromium"

If it's a newly downloaded binary, first run it manually once to ensure the operating system trusts it.

Starting the Server

npm run bidi-server

This will run the server on port 8080. Use the PORT environment variable to run it on another port:

PORT=8081 npm run bidi-server

Use the DEBUG environment variable to see debug info:

DEBUG=* npm run bidi-server

Use the HEADLESS=false environment variable to run browser in headful mode:

HEADLESS=false npm run bidi-server

Running the Tests

Note: Most of the tests currently fail, but this is how to run them.

The tests are written using Python, in order to learn how to eventually do this in web-platform-tests. Python 3.6+ and some dependencies are required:

python3 -m pip install --user -r tests/requirements.txt

Running:

python3 -m pytest --rootdir=tests

This will run the tests against an already running server on port 8080. Use the PORT environment variable to connect to another port:

PORT=8081 python3 -m pytest --rootdir=tests

How does it work?

The architecture is described in the WebDriver BiDi in Chrome Context implementation plan.

There are 2 main modules:

  1. backend WS server in src. It runs webSocket server, and for each ws connection runs an instance of browser with BiDi Mapper.
  2. front-end BiDi Mapper in src/bidiMapper. Gets BiDi commands from the backend, and map them to CDP commands.

Contributing

The BiDi commands are processed in the src/bidiMapper/bidiCommandsProcessor.js. To add a new command, add it to processCommand, write and call processor for it.

bidiinchromecontext's People

Contributors

foolip avatar mathiasbynens avatar sadym-chromium 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.