Skip to content

Commit

Permalink
Add launcher README
Browse files Browse the repository at this point in the history
  • Loading branch information
samccone committed Jun 10, 2017
1 parent 6f73b57 commit d53b8e8
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions chrome-launcher/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Chrome Launcher

Launch chrome with ease from node.

```
npm install chrome-launcher
```


## API

#### Launch options

```js
chromeLauncher.launch({
// optional staring url string
startingUrl: string;
// optional array of (string) flags to pass to chrome
chromeFlags: Array<string>;
// optional explicit remote debugging port number to use.
port: number;
// optional, handle cleaning up chrome when node process gets killed via SIGINT
handleSIGINT: boolean;
// optional, explicit path to chrome to launch
chromePath: string;
// optional, user dir path to reuse
userDataDir: string;
});
```

#### Launched chrome interface

```js
{
// process id of chrome.
pid: number;
// the remote debuging port exposed by the launched chrome.
port: number;
// a function to kill and cleanup chrome.
kill: () => Promise<{}>;
}
```


## Examples

#### Launching chrome:

```js
const chromeLauncher = require('chrome-launcher')

chromeLauncher.launch({
startingUrl: 'https://google.com'
}).then(info => {
console.log(`Chrome debugging port running on ${info.port}`);
});
```


#### Launching headless chrome:

```js
const chromeLauncher = require('chrome-launcher')

chromeLauncher.launch({
startingUrl: 'https://google.com',
chromeFlags: ['--headless']
}).then(info => {
console.log(`Chrome debugging port running on ${info.port}`);
});
```

0 comments on commit d53b8e8

Please sign in to comment.