File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
javascript/selenium-webdriver Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -680,10 +680,14 @@ class Builder {
680680 if ( this . firefoxService_ ) {
681681 service = this . firefoxService_ . build ( )
682682 }
683+
684+ // Find a free port before starting Firefox
685+ const port = portprober . findFreePort ( ) ;
686+
683687 // Allocate a free port for the websocket only when not connecting to an existing instance
684688 // This avoids conflicts when multiple Firefox instances have started
685689 if ( ! service ?. options_ . args . includes ( '--connect-existing' ) ) {
686- service ?. addArguments ( '--websocket-port' , `${ portprober . findFreePort ( ) } ` )
690+ service ?. addArguments ( '--websocket-port' , `${ port } ` )
687691 }
688692 return createDriver ( firefox . Driver , capabilities , service )
689693 }
You can’t perform that action at this time.
0 commit comments