Skip to content

Commit

Permalink
Document websocket-port arg, set it to random
Browse files Browse the repository at this point in the history
  • Loading branch information
nextlevelbeard committed Aug 11, 2023
1 parent 21fd29b commit e27e81b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export async function start (params: GeckodriverParameters) {
}

startArgs.host = startArgs.host || DEFAULT_HOSTNAME

// By default, Geckodriver uses port 9222
// User might pass a port for custom runs but they should modify them for each worker
// For remaining use cases, to enable parallel instances we need to set the port to 0 (random)
// Otherwise all instances try to connect to the default port and fail
startArgs.websocketPort = startArgs.websocketPort ?? 0;

const args = parseParams(startArgs)
log.info(`Starting Geckodriver at ${geckoDriverPath} with params: ${args.join(' ')}`)
return cp.spawn(geckoDriverPath, args)
Expand Down
4 changes: 4 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export interface GeckodriverParameters {
* port to listen on
*/
port?: number
/**
* port to use for Debugger / Webdriver BiDi
*/
websocketPort?: number
/**
* Directory in which to create profiles. Defaults to the system temporary directory.
*/
Expand Down

0 comments on commit e27e81b

Please sign in to comment.