{"id":15493453,"url":"https://github.com/sinclairzx81/drift","last_synced_at":"2025-04-22T19:49:11.735Z","repository":{"id":57837188,"uuid":"528370604","full_name":"sinclairzx81/drift","owner":"sinclairzx81","description":"Run Chrome from the Terminal","archived":false,"fork":false,"pushed_at":"2024-08-09T06:04:04.000Z","size":12743,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T18:10:01.611Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinclairzx81.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-24T10:20:49.000Z","updated_at":"2025-01-28T07:44:42.000Z","dependencies_parsed_at":"2024-08-09T07:24:50.296Z","dependency_job_id":"8bb57c79-e93f-4572-a82f-9a365ff14bb0","html_url":"https://github.com/sinclairzx81/drift","commit_stats":{"total_commits":123,"total_committers":1,"mean_commits":123.0,"dds":0.0,"last_synced_commit":"64ebbd5f69bbb8db1d04af95f3507f4404ce8cd7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinclairzx81%2Fdrift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinclairzx81%2Fdrift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinclairzx81%2Fdrift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinclairzx81%2Fdrift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinclairzx81","download_url":"https://codeload.github.com/sinclairzx81/drift/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249902692,"owners_count":21342884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T08:06:47.547Z","updated_at":"2025-04-22T19:49:11.713Z","avatar_url":"https://github.com/sinclairzx81.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align='center'\u003e\r\n\r\n\u003ch1\u003eDrift\u003c/h1\u003e\r\n\r\n\u003cp\u003eRun Chrome from the Terminal\u003c/p\u003e\r\n\r\n\u003cimg src=\".build/assets/drift.png\"\u003e\u003c/img\u003e\r\n\r\n[![npm version](https://badge.fury.io/js/%40sinclair%2Fdrift.svg)](https://badge.fury.io/js/%40sinclair%2Fdrift)\r\n[![GitHub CI](https://github.com/sinclairzx81/drift/workflows/GitHub%20CI/badge.svg)](https://github.com/sinclairzx81/drift/actions)\r\n\r\n\u003c/div\u003e\r\n\r\n## Install\r\n\r\n```bash\r\n$ npm install -g @sinclair/drift \r\n```\r\n\r\n## Usage\r\n\r\n```bash\r\n$ drift url http://localhost:5000\r\n```\r\n\r\n## Overview\r\n\r\nDrift is a command line tool that integrates the Chrome Developer Console into the terminal. It is built upon the Chrome DevTools Protocol and implements an interactive repl for running code in remote Chrome instances. Drift enables browser functionality to be developed and tested entirely from within a terminal window.\r\n\r\nDrift works similar to Node but runs code in constrained browser environments. It can be used for browser automation, running browser code in CI environments or used as a general purpose scripting tool.\r\n\r\nLicense MIT\r\n\r\n## Contents\r\n\r\n- [Install](#Install)\r\n- [Commands](#Commands)\r\n- [Examples](#Examples)\r\n- [Testing](#Testing)\r\n- [Contribute](#Contribute)\r\n\r\n## Commands\r\n\r\nThe Drift CLI accepts a series of commands which are run in sequence against a sandboxed Chrome instance. When all commands have completed, Drift will enter an interactive repl similar to the Chrome DevTools Console. \r\n\r\nThe following is the Drift command line interface\r\n```\r\nFormat:\r\n\r\n  $ drift [...command]\r\n\r\nExamples:\r\n\r\n  $ drift url https://domain.com\r\n  $ drift run script.ts\r\n  $ drift url https://domain.com run script.ts\r\n  $ drift url https://domain.com wait 1000 save image.png\r\n  $ drift window devtools url https://domain.com\r\n\r\nCommands:\r\n\r\n  url         url         Load page\r\n  run         path        Add script to page\r\n  css         path        Add style to page\r\n  save        path        Save page as image or pdf\r\n  args        [...args]   Adds args to Drift.args\r\n  watch       [...path]   Watch and reload\r\n  user        path        User directory\r\n  mousedown   x y         Send mousedown event\r\n  position    x y         Desktop window position\r\n  size        w h         Desktop window size\r\n  wait        ms          Wait timeout\r\n  reload                  Reload page\r\n  close                   Close drift\r\n\r\nFlags:\r\n\r\n  window                  Open window\r\n  devtools                Open devtools\r\n  incognto                Open incognito\r\n  verbose                 Log Chrome messages\r\n  reset                   Reset user directory\r\n  fail                    Close drift on exceptions\r\n  help                    Show this help message\r\n\r\n\r\n```\r\n\r\n## Examples\r\n\r\nThe following are some examples\r\n\r\n```bash\r\n# starts with interactive repl\r\n\r\n$ drift\r\n```\r\n```bash\r\n# opens github.com\r\n\r\n$ drift url http://github.com\r\n```\r\n\r\n```bash\r\n# runs index.ts\r\n\r\n$ drift run index.ts\r\n```\r\n\r\n```bash\r\n# opens a window, runs index.ts, waits 5 seconds then closes\r\n\r\n$ drift window run index.ts wait 5000 close\r\n```\r\n\r\n```bash\r\n# opens github.com, waits 4 seconds then takes a screenshot\r\n\r\n$ drift url https://github.com wait 4000 save screenshot.png\r\n```\r\n\r\n## Testing\r\n\r\nWhen testing browser code in CI environments, call `close(...)` to terminate the process with a non zero exit code on error. CI environments will interpret this is a failed process.\r\n\r\n```typescript\r\ntest().then(() =\u003e close(0)).catch(() =\u003e close(1))\r\n```\r\n\r\nWhich can be run on CI environments with the following.\r\n\r\n```bash\r\n$ drift run test.ts\r\n```\r\n\r\n## Contribute\r\n\r\nDrift is open to community contribution. Please ensure you submit an open issue before submitting a pull request. The Drift project preferences open community discussion prior to accepting new features.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinclairzx81%2Fdrift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinclairzx81%2Fdrift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinclairzx81%2Fdrift/lists"}