Skip to content

Commit 3440b61

Browse files
committed
Adding .NET ctors to FirefoxDriver to align with other browser drivers
1 parent e7065a5 commit 3440b61

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

dotnet/src/webdriver/Firefox/FirefoxDriver.cs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="FirefoxDriver.cs" company="WebDriver Committers">
1+
// <copyright file="FirefoxDriver.cs" company="WebDriver Committers">
22
// Licensed to the Software Freedom Conservancy (SFC) under one
33
// or more contributor license agreements. See the NOTICE file
44
// distributed with this work for additional information
@@ -111,6 +111,7 @@ public FirefoxDriver()
111111
/// </summary>
112112
/// <param name="profile">A <see cref="FirefoxProfile"/> object representing the profile settings
113113
/// to be used in starting Firefox.</param>
114+
[Obsolete("FirefoxDriver should not be constructed with a FirefoxProfile object. Use FirefoxOptions instead. This constructor will be removed in a future release.")]
114115
public FirefoxDriver(FirefoxProfile profile)
115116
: this(new FirefoxOptions(profile, null))
116117
{
@@ -150,7 +151,7 @@ public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile)
150151
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
151152
[Obsolete("FirefoxDriver should not be constructed with a FirefoxBinary object. Use FirefoxOptions instead. This constructor will be removed in a future release.")]
152153
public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
153-
: this(null, new FirefoxOptions(profile, binary), commandTimeout)
154+
: this((FirefoxDriverService)null, new FirefoxOptions(profile, binary), commandTimeout)
154155
{
155156
}
156157

@@ -172,6 +173,39 @@ public FirefoxDriver(FirefoxDriverService service)
172173
{
173174
}
174175

176+
/// <summary>
177+
/// Initializes a new instance of the <see cref="FirefoxDriver"/> class using the specified path
178+
/// to the directory containing ChromeDriver.exe.
179+
/// </summary>
180+
/// <param name="geckoDriverDirectory">The full path to the directory containing geckodriver.exe.</param>
181+
public FirefoxDriver(string geckoDriverDirectory)
182+
: this(geckoDriverDirectory, new FirefoxOptions())
183+
{
184+
}
185+
186+
/// <summary>
187+
/// Initializes a new instance of the <see cref="ChromeDriver"/> class using the specified path
188+
/// to the directory containing ChromeDriver.exe and options.
189+
/// </summary>
190+
/// <param name="geckoDriverDirectory">The full path to the directory containing ChromeDriver.exe.</param>
191+
/// <param name="options">The <see cref="ChromeOptions"/> to be used with the Chrome driver.</param>
192+
public FirefoxDriver(string geckoDriverDirectory, FirefoxOptions options)
193+
: this(geckoDriverDirectory, options, RemoteWebDriver.DefaultCommandTimeout)
194+
{
195+
}
196+
197+
/// <summary>
198+
/// Initializes a new instance of the <see cref="ChromeDriver"/> class using the specified path
199+
/// to the directory containing ChromeDriver.exe, options, and command timeout.
200+
/// </summary>
201+
/// <param name="geckoDriverDirectory">The full path to the directory containing ChromeDriver.exe.</param>
202+
/// <param name="options">The <see cref="ChromeOptions"/> to be used with the Chrome driver.</param>
203+
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
204+
public FirefoxDriver(string geckoDriverDirectory, FirefoxOptions options, TimeSpan commandTimeout)
205+
: this(FirefoxDriverService.CreateDefaultService(geckoDriverDirectory), options, commandTimeout)
206+
{
207+
}
208+
175209
/// <summary>
176210
/// Initializes a new instance of the <see cref="FirefoxDriver"/> class using the specified options, driver service, and timeout. Uses the Mozilla-provided Marionette driver implementation.
177211
/// </summary>

0 commit comments

Comments
 (0)