dcx is a minimalistic Selenium-based browser automation wrapper for running small web workflows from a simple JSON file.
The project is designed for practical automation work: open a page, interact with elements, type values, click buttons, pause execution, and keep the workflow readable without requiring a large Python codebase. It can be installed from PyPI and started via python -m dcx, with Firefox as the default browser and optional Chrome or remote WebDriver modes available.
- simple JSON-based workflow format
- command-line interface
- local Firefox support by default
- optional local Chrome support
- optional remote Firefox and remote Edge execution
- interactive halt / breakpoint support
- temporary log directory with optional retention
- environment variable expansion inside workflow values
- sample workflow generation via
--gen
Install from PyPI:
pip install dcxYou can then start it with:
python -m dcx --helpA workflow is defined in a file named play.js in your working directory.
Despite the filename, play.js is JSON, not JavaScript. The root element is an array, and each entry is a single step. Each step is itself an array:
- 1st column: XPath selector or
null - 2nd column: command name
- 3rd, 4th, ... column: optional command parameters
Minimal structure:
[
[],
[],
[]
]Minimal runnable example:
[
[null, "get", "https://127.0.0.1:8080/"],
[null, "halt"]
]The repository also includes a sample workflow that opens Google, waits, clicks, types into the search box, submits the query, and then halts.
Create a new empty directory for your workflow:
mkdir EXAMPLE_WORKFLOW
cd EXAMPLE_WORKFLOWGenerate a starter workflow:
python -m dcx --genRun it with Firefox:
python -m dcxOr with Chrome:
python -m dcx --local-chromeIf you prefer a shorter launcher command, the documentation recommends creating a small wrapper script in your PATH that forwards to python -m dcx "$@".
[
[null, "get", "https://example.com"],
["//input[@name='q']", "type", "hello world"],
["//form", "submit"],
[null, "halt"]
]The bundled cheatsheet currently documents commands such as:
get— open a URLpath— open a path on the current hostclick— click an elementtype— send keys to an elementsetvalue— set a value through JavaScriptclear— clear an inputsleep— wait for a number of secondshalt— pause execution interactivelybash— run a shell commandbash0— run a shell command and force a zero-style result handlingsetenv— define environment variables during runtimeattribute_setenv— copy an element attribute into an environment variablesam— speak text via macOS Samantha voice
For the full command reference, see cheatsheet.html or cheatsheet.txt in the repository.
dcx supports multiple execution modes:
This is the default mode:
python -m dcxpython -m dcx --local-chromepython -m dcx --remote-firefoxpython -m dcx --remote-edge --no-imgThe repository also includes helper scripts in src/ for these modes.
During execution, dcx creates a log directory with browser-mode-specific runtime data. According to the documentation, this directory is removed automatically by default.
To keep logs for inspection, use:
python -m dcx --logdcx pre-fills at least these variables for expansion:
$PWD$HOME
The generated workflow hint also notes that you can extend the environment through a play.env file.
Based on the current code and helper scripts, useful options include:
--gen— generate a starterplay.js--local-chrome— use local Chrome--remote-firefox— use remote Firefox--remote-edge— use remote Edge--log— keep the log directory--headless— run headless--no-dev— disable Firefox devtools startup behaviour--pre-bash— run a shell command before automation starts--unzip-profile— restore a browser profile from an archive
manual/ documentation sources
src/
├── dcx/ Python package
├── play.js sample workflow
├── run.sh local default launcher
├── run_chrome.sh local Chrome launcher
├── run_remote_edge.sh
└── run_remote_firefox.sh
cheatsheet.html generated command reference
cheatsheet.txt plain text command reference
BUILD.txt short release/build notes
VERSION package version
The repository contains small launcher scripts such as:
#!/bin/bash
vp -m dcx "$@"and browser-specific variants like:
#!/bin/bash
vp -m dcx "$@" --local-chromeThis makes it easy to create your own local shortcuts around the CLI.
dcx is a good fit when you want:
- lightweight browser automation without building a full Selenium test suite
- repeatable “playbook” style workflows
- quick XPath-driven interactions
- simple test or scraping helpers
- browser automation that can be handed to less code-heavy users
Additional documentation is already included in the repository:
manual/cheatsheet.htmlcheatsheet.txt
These files describe installation, workflow structure, and the available command set.
The PyPI package metadata currently lists the project as MIT licensed. If you want the GitHub repository to communicate that clearly as well, adding a LICENSE file to the repository would be a good idea.
Donation welcome at https://www.paypal.com/donate/?hosted_button_id=4EZE2QKKG29JE