Class FirefoxDriverService
Exposes the service provided by the native FirefoxDriver executable.
public sealed class FirefoxDriverService : DriverService, ICommandServer, IDisposable
- Inheritance
-
FirefoxDriverService
- Implements
- Inherited Members
Properties
BrowserCommunicationHost
Gets or sets the value of the IP address of the host adapter used by the driver executable to communicate with the browser.
public string? BrowserCommunicationHost { get; set; }
Property Value
Remarks
BrowserCommunicationPort
Gets or sets the port used by the driver executable to communicate with the browser.
public int BrowserCommunicationPort { get; set; }
Property Value
Remarks
A negative or zero value indicates no port value to specify.
CommandLineArguments
Gets the command-line arguments for the driver service.
protected override string CommandLineArguments { get; }
Property Value
ConnectToRunningBrowser
Gets or sets a value indicating whether to connect to an already-running instance of Firefox.
public bool ConnectToRunningBrowser { get; set; }
Property Value
FirefoxBinaryPath
Gets or sets the location of the Firefox binary executable.
public string? FirefoxBinaryPath { get; set; }
Property Value
Remarks
HasShutdown
Gets a value indicating whether the service has a shutdown API that can be called to terminate it gracefully before forcing a termination.
protected override bool HasShutdown { get; }
Property Value
Host
Gets or sets the value of the IP address of the host adapter on which the service should listen for connections.
public string? Host { get; set; }
Property Value
Remarks
LogLevel
Gets or sets the level at which log output is displayed.
public FirefoxDriverLogLevel LogLevel { get; set; }
Property Value
Remarks
This is largely equivalent to setting the LogLevel property, except the log level is set when the driver launches, instead of when the browser is launched, meaning that initial driver logging before initiation of a session can be controlled.
LogPath
Gets or sets the file path where log output should be written.
public string? LogPath { get; set; }
Property Value
Remarks
A null or Empty value indicates no log file to specify. This approach takes the process output and redirects it to a file because GeckoDriver does not offer a way to specify a log file path directly.
LogTruncate
Gets or sets a value indicating whether to disable truncation of long log lines in GeckoDriver.
public bool? LogTruncate { get; set; }
Property Value
- bool?
Remarks
A null value indicates no log truncation setting to specify. Set to true to disable truncation, or false to enable truncation.
OpenBrowserToolbox
Gets or sets a value indicating whether to open the Firefox Browser Toolbox when Firefox is launched.
public bool OpenBrowserToolbox { get; set; }
Property Value
ProfileRoot
Directory in which GeckoDriver creates profiles.
public string? ProfileRoot { get; set; }
Property Value
TerminationTimeout
Gets a value indicating the time to wait for the service to terminate before forcing it to terminate.
protected override TimeSpan TerminationTimeout { get; }
Property Value
Methods
CreateDefaultService()
Creates a default instance of the FirefoxDriverService.
public static FirefoxDriverService CreateDefaultService()
Returns
- FirefoxDriverService
A FirefoxDriverService that implements default settings.
CreateDefaultService(string?)
Creates a default instance of the FirefoxDriverService using a specified path to the Firefox driver executable.
public static FirefoxDriverService CreateDefaultService(string? driverPath)
Parameters
driverPath
stringThe path to the executable or the directory containing the Firefox driver executable.
Returns
- FirefoxDriverService
A FirefoxDriverService using a random port.
CreateDefaultService(string?, string?)
Creates a default instance of the FirefoxDriverService using a specified path to the Firefox driver executable with the given name.
public static FirefoxDriverService CreateDefaultService(string? driverPath, string? driverExecutableFileName)
Parameters
driverPath
stringThe directory containing the Firefox driver executable.
driverExecutableFileName
stringThe name of the Firefox driver executable file.
Returns
- FirefoxDriverService
A FirefoxDriverService using a random port.
Dispose(bool)
Disposes of the resources used by the FirefoxDriverService instance.
protected override void Dispose(bool disposing)
Parameters
disposing
boolA value indicating whether the method is being called from Dispose.
Remarks
If disposing is true, it disposes of the log writer if it exists.
GetDefaultDriverOptions()
The browser options instance that corresponds to the driver service
protected override DriverOptions GetDefaultDriverOptions()
Returns
OnDriverProcessDataReceived(object, DataReceivedEventArgs)
Handles the output and error data received from the driver process and sends it to the log writer if available.
protected override void OnDriverProcessDataReceived(object sender, DataReceivedEventArgs args)
Parameters
sender
objectThe sender of the event.
args
DataReceivedEventArgsThe data received event arguments.
OnDriverProcessStarting(DriverProcessStartingEventArgs)
Called when the driver process is starting. This method sets up log file writing if a log path is specified.
protected override void OnDriverProcessStarting(DriverProcessStartingEventArgs eventArgs)
Parameters
eventArgs
DriverProcessStartingEventArgsThe event arguments containing information about the driver service process.
Remarks
This method initializes a log writer if a log path is specified.