@@ -789,8 +789,8 @@ class WebDriver {
789789      // If the websocket connection is not closed, 
790790      // and we are running CDP sessions against the Selenium Grid, 
791791      // the node process never exits since the websocket connection is open until the Grid is shutdown. 
792-       if  ( this . _cdpConnection  !==  undefined )  { 
793-         this . _cdpConnection . close ( ) 
792+       if  ( this . _cdpWsConnection  !==  undefined )  { 
793+         this . _cdpWsConnection . close ( ) 
794794      } 
795795
796796      // Close the BiDi websocket connection 
@@ -1246,18 +1246,18 @@ class WebDriver {
12461246    this . _wsUrl  =  await  this . getWsUrl ( debuggerUrl ,  target ,  caps ) 
12471247    return  new  Promise ( ( resolve ,  reject )  =>  { 
12481248      try  { 
1249-         this . _cdpConnection  =  new  WebSocket ( this . _wsUrl . replace ( 'localhost' ,  '127.0.0.1' ) ) 
1250-         this . _cdpConnection  =  new  cdp . CdpConnection ( this . _cdpConnection ) 
1249+         this . _cdpWsConnection  =  new  WebSocket ( this . _wsUrl . replace ( 'localhost' ,  '127.0.0.1' ) ) 
1250+         this . _cdpConnection  =  new  cdp . CdpConnection ( this . _cdpWsConnection ) 
12511251      }  catch  ( err )  { 
12521252        reject ( err ) 
12531253        return 
12541254      } 
12551255
1256-       this . _cdpConnection . on ( 'open' ,  async  ( )  =>  { 
1256+       this . _cdpWsConnection . on ( 'open' ,  async  ( )  =>  { 
12571257        await  this . getCdpTargets ( ) 
12581258      } ) 
12591259
1260-       this . _cdpConnection . on ( 'message' ,  async  ( message )  =>  { 
1260+       this . _cdpWsConnection . on ( 'message' ,  async  ( message )  =>  { 
12611261        const  params  =  JSON . parse ( message ) 
12621262        if  ( params . result )  { 
12631263          if  ( params . result . targetInfos )  { 
@@ -1278,7 +1278,7 @@ class WebDriver {
12781278        } 
12791279      } ) 
12801280
1281-       this . _cdpConnection . on ( 'error' ,  ( error )  =>  { 
1281+       this . _cdpWsConnection . on ( 'error' ,  ( error )  =>  { 
12821282        reject ( error ) 
12831283      } ) 
12841284    } ) 
@@ -1346,7 +1346,7 @@ class WebDriver {
13461346   * @param  connection CDP Connection 
13471347   */ 
13481348  async  register ( username ,  password ,  connection )  { 
1349-     this . _cdpConnection . on ( 'message' ,  ( message )  =>  { 
1349+     this . _cdpWsConnection . on ( 'message' ,  ( message )  =>  { 
13501350      const  params  =  JSON . parse ( message ) 
13511351
13521352      if  ( params . method  ===  'Fetch.authRequired' )  { 
@@ -1391,7 +1391,7 @@ class WebDriver {
13911391   * @param  callback callback called when we intercept requests. 
13921392   */ 
13931393  async  onIntercept ( connection ,  httpResponse ,  callback )  { 
1394-     this . _cdpConnection . on ( 'message' ,  ( message )  =>  { 
1394+     this . _cdpWsConnection . on ( 'message' ,  ( message )  =>  { 
13951395      const  params  =  JSON . parse ( message ) 
13961396      if  ( params . method  ===  'Fetch.requestPaused' )  { 
13971397        const  requestPausedParams  =  params [ 'params' ] 
@@ -1428,7 +1428,7 @@ class WebDriver {
14281428   * @returns  {Promise<void> } 
14291429   */ 
14301430  async  onLogEvent ( connection ,  callback )  { 
1431-     this . _cdpConnection . on ( 'message' ,  ( message )  =>  { 
1431+     this . _cdpWsConnection . on ( 'message' ,  ( message )  =>  { 
14321432      const  params  =  JSON . parse ( message ) 
14331433      if  ( params . method  ===  'Runtime.consoleAPICalled' )  { 
14341434        const  consoleEventParams  =  params [ 'params' ] 
@@ -1465,7 +1465,7 @@ class WebDriver {
14651465  async  onLogException ( connection ,  callback )  { 
14661466    await  connection . execute ( 'Runtime.enable' ,  { } ,  null ) 
14671467
1468-     this . _cdpConnection . on ( 'message' ,  ( message )  =>  { 
1468+     this . _cdpWsConnection . on ( 'message' ,  ( message )  =>  { 
14691469      const  params  =  JSON . parse ( message ) 
14701470
14711471      if  ( params . method  ===  'Runtime.exceptionThrown' )  { 
@@ -1518,7 +1518,7 @@ class WebDriver {
15181518      null , 
15191519    ) 
15201520
1521-     this . _cdpConnection . on ( 'message' ,  async  ( message )  =>  { 
1521+     this . _cdpWsConnection . on ( 'message' ,  async  ( message )  =>  { 
15221522      const  params  =  JSON . parse ( message ) 
15231523      if  ( params . method  ===  'Runtime.bindingCalled' )  { 
15241524        let  payload  =  JSON . parse ( params [ 'params' ] [ 'payload' ] ) 
0 commit comments