Skip to content

Commit

Permalink
set edgedriver binary url
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Aug 19, 2023
1 parent 16a583d commit 84b331f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,28 @@ const { start } = require('edgedriver')
// see example above
```

## Custom CDN URL

This allows you to use your own endpoints for downloading Edgedriver binaries. It is useful in air gapped scenarios or if you have download restrictions, such as firewalls. You can either set an environment variable:

```sh
$ npm i edgedriver
$ EDGEDRIVER_CDNURL=https://msedgedriver.azureedge.net npx edgedriver --version
```

or create a [`.npmrc`](https://docs.npmjs.com/cli/configuring-npm/npmrc) with the following content:

```toml
edgedriver_cdnurl=https://msedgedriver.azureedge.net
```

## Options

The `start` method offers the following options to be passed on to the actual Edgedriver CLI.

### edgeDriverVersion

The version of EdgeDriver to start. See https://msedgedriver.azureedge.net/ for all available versions, platforms and architecture.
The version of EdgeDriver to start. See [Egdedriver directory list](https://msedgewebdriverstorage.z22.web.core.windows.net/) for all available versions, platforms and architecture.

Type: `number`<br />
Default: `latest`
Expand Down Expand Up @@ -185,7 +200,6 @@ The path to the root of the cache directory.
Type: `string`<br />
Default: `process.env.EDGEDRIVER_CACHE_DIR || os.tmpdir()`


---

For more information on WebdriverIO see the [homepage](https://webdriver.io).
11 changes: 8 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ import os from 'node:os'
import logger from '@wdio/logger'

export const TAGGED_VERSIONS = ['stable', 'beta', 'dev', 'canary']
export const DOWNLOAD_URL = 'https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/%s/%s.zip'
export const TAGGED_VERSION_URL = 'https://msedgedriver.azureedge.net/LATEST_%s'
export const LATEST_RELEASE_URL = 'https://msedgedriver.azureedge.net/LATEST_RELEASE_%s_%s'
export const BASE_CDN_URL = (
process.env.EDGEDRIVER_CDNURL ||
process.env.npm_config_edgedriver_cdnurl ||
'https://msedgedriver.azureedge.net'
)
export const DOWNLOAD_URL = `${BASE_CDN_URL}/%s/%s.zip`
export const TAGGED_VERSION_URL = `${BASE_CDN_URL}/LATEST_%s`
export const LATEST_RELEASE_URL = `${BASE_CDN_URL}/LATEST_RELEASE_%s_%s`
export const BINARY_FILE = 'msedgedriver' + (os.platform() === 'win32' ? '.exe' : '')
export const DEFAULT_ALLOWED_ORIGINS = ['*']
export const DEFAULT_ALLOWED_IPS = ['']
Expand Down
4 changes: 4 additions & 0 deletions tests/test.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import waitPort from 'wait-port'
import { remote } from 'webdriverio'

import findEdgePath from '../dist/finder.js'
import { start } from '../dist/index.js'

const port = 4444
Expand All @@ -12,6 +13,9 @@ try {
port,
capabilities: {
browserName: 'MicrosoftEdge',
'ms:edgeOptions': {
binary: findEdgePath()
}
}
})
await browser.url('https://webdriver.io')
Expand Down

0 comments on commit 84b331f

Please sign in to comment.