1717// under the License.
1818// </copyright>
1919
20- using OpenQA . Selenium . DevTools ;
2120using OpenQA . Selenium . Remote ;
2221using System ;
2322using System . Collections . Generic ;
@@ -71,11 +70,8 @@ namespace OpenQA.Selenium.Firefox
7170 /// }
7271 /// </code>
7372 /// </example>
74- public class FirefoxDriver : WebDriver , IDevTools
73+ public class FirefoxDriver : WebDriver
7574 {
76- private const int FirefoxDevToolsProtocolVersion = 85 ;
77- private const string FirefoxDevToolsCapabilityName = "moz:debuggerAddress" ;
78-
7975 /// <summary>
8076 /// Command for setting the command context of a Firefox driver.
8177 /// </summary>
@@ -110,8 +106,6 @@ public class FirefoxDriver : WebDriver, IDevTools
110106 { GetFullPageScreenshotCommand , new HttpCommandInfo ( HttpCommandInfo . GetCommand , "/session/{sessionId}/moz/screenshot/full" ) }
111107 } ;
112108
113- private DevToolsSession devToolsSession ;
114-
115109 /// <summary>
116110 /// Initializes a new instance of the <see cref="FirefoxDriver"/> class.
117111 /// </summary>
@@ -244,14 +238,6 @@ public override IFileDetector FileDetector
244238 set { }
245239 }
246240
247- /// <summary>
248- /// Gets a value indicating whether a DevTools session is active.
249- /// </summary>
250- public bool HasActiveDevToolsSession
251- {
252- get { return this . devToolsSession != null ; }
253- }
254-
255241 /// <summary>
256242 /// Sets the command context used when issuing commands to geckodriver.
257243 /// </summary>
@@ -389,68 +375,6 @@ public Screenshot GetFullPageScreenshot()
389375 return new Screenshot ( base64 ) ;
390376 }
391377
392- /// <summary>
393- /// Creates a session to communicate with a browser using the Chromium Developer Tools debugging protocol.
394- /// </summary>
395- /// <returns>The active session to use to communicate with the Chromium Developer Tools debugging protocol.</returns>
396- [ Obsolete ( "CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi." ) ]
397- public DevToolsSession GetDevToolsSession ( )
398- {
399- return GetDevToolsSession ( new DevToolsOptions ( ) { ProtocolVersion = FirefoxDevToolsProtocolVersion } ) ;
400- }
401-
402- /// <summary>
403- /// Creates a session to communicate with a browser using the Chromium Developer Tools debugging protocol.
404- /// </summary>
405- /// <param name="devToolsProtocolVersion">The version of the Chromium Developer Tools protocol to use. Defaults to autodetect the protocol version.</param>
406- /// <returns>The active session to use to communicate with the Chromium Developer Tools debugging protocol.</returns>
407- [ Obsolete ( "Use GetDevToolsSession(DevToolsOptions options)" ) ]
408- public DevToolsSession GetDevToolsSession ( int devToolsProtocolVersion )
409- {
410- return GetDevToolsSession ( new DevToolsOptions ( ) { ProtocolVersion = devToolsProtocolVersion } ) ;
411- }
412-
413- /// <summary>
414- /// Creates a session to communicate with a browser using a Developer Tools debugging protocol.
415- /// </summary>
416- /// <returns>The active session to use to communicate with the Developer Tools debugging protocol.</returns>
417- [ Obsolete ( "CDP support for Firefox is deprecated and will be removed in future versions. Please switch to WebDriver BiDi." ) ]
418- public DevToolsSession GetDevToolsSession ( DevToolsOptions options )
419- {
420- if ( this . devToolsSession == null )
421- {
422- if ( ! this . Capabilities . HasCapability ( FirefoxDevToolsCapabilityName ) )
423- {
424- throw new WebDriverException ( "Cannot find " + FirefoxDevToolsCapabilityName + " capability for driver" ) ;
425- }
426-
427- string debuggerAddress = this . Capabilities . GetCapability ( FirefoxDevToolsCapabilityName ) . ToString ( ) ;
428- try
429- {
430- DevToolsSession session = new DevToolsSession ( debuggerAddress , options ) ;
431- Task . Run ( async ( ) => await session . StartSession ( ) ) . GetAwaiter ( ) . GetResult ( ) ;
432- this . devToolsSession = session ;
433- }
434- catch ( Exception e )
435- {
436- throw new WebDriverException ( "Unexpected error creating WebSocket DevTools session." , e ) ;
437- }
438- }
439-
440- return this . devToolsSession ;
441- }
442-
443- /// <summary>
444- /// Closes a DevTools session.
445- /// </summary>
446- public void CloseDevToolsSession ( )
447- {
448- if ( this . devToolsSession != null )
449- {
450- Task . Run ( async ( ) => await this . devToolsSession . StopSession ( true ) ) . GetAwaiter ( ) . GetResult ( ) ;
451- }
452- }
453-
454378 /// <summary>
455379 /// In derived classes, the <see cref="PrepareEnvironment"/> method prepares the environment for test execution.
456380 /// </summary>
@@ -467,15 +391,6 @@ protected virtual void PrepareEnvironment()
467391 /// disposing the object; otherwise <see langword="false"/>.</param>
468392 protected override void Dispose ( bool disposing )
469393 {
470- if ( disposing )
471- {
472- if ( this . devToolsSession != null )
473- {
474- this . devToolsSession . Dispose ( ) ;
475- this . devToolsSession = null ;
476- }
477- }
478-
479394 base . Dispose ( disposing ) ;
480395 }
481396
0 commit comments