Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dotnet/src/support/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ csharp_library(
"//dotnet:source_files_support_needs_from_core",
],
out = "WebDriver.Support",
langversion = "12.0",
langversion = "14.0",
nullable = "enable",
target_frameworks = [
"netstandard2.0",
Expand Down Expand Up @@ -80,7 +80,7 @@ csharp_library(
],
out = "WebDriver.Support.StrongNamed",
keyfile = "//dotnet:Selenium.snk",
langversion = "12.0",
langversion = "14.0",
nullable = "enable",
target_frameworks = [
"netstandard2.0",
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/support/Selenium.WebDriver.Support.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>WebDriver.Support</AssemblyName>
<RootNamespace>OpenQA.Selenium.Support</RootNamespace>
<BuildSystem>visual-studio</BuildSystem>
<LangVersion>12.0</LangVersion>
<LangVersion>14.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
12 changes: 6 additions & 6 deletions dotnet/src/webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ csharp_library(
internals_visible_to = [
"WebDriver.Common.Tests",
],
langversion = "12.0",
langversion = "14.0",
nullable = "enable",
target_frameworks = [
"net462",
Expand Down Expand Up @@ -83,7 +83,7 @@ csharp_library(
internals_visible_to = [
"WebDriver.Common.Tests",
],
langversion = "12.0",
langversion = "14.0",
nullable = "enable",
resources = [],
target_frameworks = [
Expand Down Expand Up @@ -119,7 +119,7 @@ csharp_library(
internals_visible_to = [
"WebDriver.Common.Tests",
],
langversion = "12.0",
langversion = "14.0",
nullable = "enable",
resources = [],
target_frameworks = [
Expand All @@ -142,7 +142,7 @@ csharp_library(
]) + devtools_version_targets(),
out = "WebDriver.StrongNamed",
keyfile = "//dotnet:Selenium.snk",
langversion = "12.0",
langversion = "14.0",
nullable = "enable",
target_frameworks = [
"net462",
Expand Down Expand Up @@ -172,7 +172,7 @@ csharp_library(
]) + devtools_version_targets(),
out = "WebDriver.StrongNamed",
keyfile = "//dotnet:Selenium.snk",
langversion = "12.0",
langversion = "14.0",
nullable = "enable",
resources = [],
target_frameworks = [
Expand Down Expand Up @@ -206,7 +206,7 @@ csharp_library(
"NET8_0_OR_GREATER",
],
keyfile = "//dotnet:Selenium.snk",
langversion = "12.0",
langversion = "14.0",
nullable = "enable",
resources = [],
target_frameworks = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ public static class PermissionsBiDiExtensions
{
public static PermissionsModule AsPermissions(this BiDi bidi)
{
if (bidi is null)
{
throw new ArgumentNullException(nameof(bidi));
}
ArgumentNullException.ThrowIfNull(bidi);

return bidi.AsModule<PermissionsModule>();
}
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/WebDriver.Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static class WebDriverExtensions
{
public static async Task<BiDi> AsBiDiAsync(this IWebDriver webDriver, BiDiOptions? options = null)
{
if (webDriver is null) throw new ArgumentNullException(nameof(webDriver));
ArgumentNullException.ThrowIfNull(webDriver);

string? webSocketUrl = null;

Expand Down
10 changes: 2 additions & 8 deletions dotnet/src/webdriver/Chromium/ChromiumDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,9 @@ protected ChromiumDriver(ChromiumDriverService service, ChromiumOptions options,
/// <returns></returns>
private static ICommandExecutor GenerateDriverServiceCommandExecutor(DriverService service, DriverOptions options, TimeSpan commandTimeout)
{
if (service is null)
{
throw new ArgumentNullException(nameof(service));
}
ArgumentNullException.ThrowIfNull(service);

if (options is null)
{
throw new ArgumentNullException(nameof(options));
}
ArgumentNullException.ThrowIfNull(options);

if (service.DriverServicePath == null)
{
Expand Down
5 changes: 1 addition & 4 deletions dotnet/src/webdriver/Cookie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,7 @@ internal long? ExpirySeconds
/// <returns>A <see cref="Cookie"/> object with the proper parameters set.</returns>
public static Cookie FromDictionary(Dictionary<string, object?> rawCookie)
{
if (rawCookie == null)
{
throw new ArgumentNullException(nameof(rawCookie));
}
ArgumentNullException.ThrowIfNull(rawCookie);

string name = rawCookie["name"]!.ToString()!;
string value = string.Empty;
Expand Down
10 changes: 2 additions & 8 deletions dotnet/src/webdriver/CookieJar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ public ReadOnlyCollection<Cookie> AllCookies
/// <exception cref="ArgumentNullException">If <paramref name="cookie"/> is <see langword="null"/>.</exception>
public void AddCookie(Cookie cookie)
{
if (cookie is null)
{
throw new ArgumentNullException(nameof(cookie));
}
ArgumentNullException.ThrowIfNull(cookie);

Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("cookie", cookie);
Expand Down Expand Up @@ -92,10 +89,7 @@ public void DeleteCookieNamed(string name)
/// <exception cref="ArgumentNullException">If <paramref name="cookie"/> is <see langword="null"/>.</exception>
public void DeleteCookie(Cookie cookie)
{
if (cookie is null)
{
throw new ArgumentNullException(nameof(cookie));
}
ArgumentNullException.ThrowIfNull(cookie);

this.DeleteCookieNamed(cookie.Name);
}
Expand Down
10 changes: 2 additions & 8 deletions dotnet/src/webdriver/DevTools/CommandResponseTypeMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ public class CommandResponseTypeMap
/// <exception cref="ArgumentNullException">If <paramref name="commandSettingsType"/> or <paramref name="commandResponseType"/> are <see langword="null"/>.</exception>
public void AddCommandResponseType(Type commandSettingsType, Type commandResponseType)
{
if (commandSettingsType is null)
{
throw new ArgumentNullException(nameof(commandSettingsType));
}
ArgumentNullException.ThrowIfNull(commandSettingsType);

if (commandResponseType is null)
{
throw new ArgumentNullException(nameof(commandResponseType));
}
ArgumentNullException.ThrowIfNull(commandResponseType);

if (!commandResponseTypeDictionary.ContainsKey(commandSettingsType))
{
Expand Down
10 changes: 2 additions & 8 deletions dotnet/src/webdriver/DevTools/WebSocketConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ public WebSocketConnection(TimeSpan startupTimeout, TimeSpan shutdownTimeout)
/// <exception cref="TimeoutException">Thrown when the connection is not established within the startup timeout.</exception>
public virtual async Task Start(string url)
{
if (url is null)
{
throw new ArgumentNullException(nameof(url));
}
ArgumentNullException.ThrowIfNull(url);

this.Log($"Opening connection to URL {url}", DevToolsSessionLogLevel.Trace);
bool connected = false;
Expand Down Expand Up @@ -162,10 +159,7 @@ public virtual async Task Stop()
/// <returns>The task object representing the asynchronous operation.</returns>
public virtual async Task SendData(string data)
{
if (data is null)
{
throw new ArgumentNullException(nameof(data));
}
ArgumentNullException.ThrowIfNull(data);

ArraySegment<byte> messageBuffer = new ArraySegment<byte>(Encoding.UTF8.GetBytes(data));
this.Log($"SEND >>> {data}");
Expand Down
35 changes: 7 additions & 28 deletions dotnet/src/webdriver/DevTools/v141/V141Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ public override async Task DisableFetch()
/// <exception cref="ArgumentNullException">If <paramref name="userAgent"/> is null.</exception>
public override async Task SetUserAgentOverride(UserAgent userAgent)
{
if (userAgent is null)
{
throw new ArgumentNullException(nameof(userAgent));
}
ArgumentNullException.ThrowIfNull(userAgent);

await network.SetUserAgentOverride(new SetUserAgentOverrideCommandSettings()
{
Expand All @@ -139,10 +136,7 @@ await network.SetUserAgentOverride(new SetUserAgentOverrideCommandSettings()
/// <exception cref="ArgumentNullException">If <paramref name="requestData"/> is <see langword="null"/>.</exception>
public override async Task ContinueRequest(HttpRequestData requestData)
{
if (requestData is null)
{
throw new ArgumentNullException(nameof(requestData));
}
ArgumentNullException.ThrowIfNull(requestData);

var commandSettings = new ContinueRequestCommandSettings()
{
Expand Down Expand Up @@ -179,15 +173,9 @@ public override async Task ContinueRequest(HttpRequestData requestData)
/// <exception cref="ArgumentNullException">If <paramref name="requestData"/> or <paramref name="responseData"/> are <see langword="null"/>.</exception>
public override async Task ContinueRequestWithResponse(HttpRequestData requestData, HttpResponseData responseData)
{
if (requestData is null)
{
throw new ArgumentNullException(nameof(requestData));
}
ArgumentNullException.ThrowIfNull(requestData);

if (responseData is null)
{
throw new ArgumentNullException(nameof(responseData));
}
ArgumentNullException.ThrowIfNull(responseData);

var commandSettings = new FulfillRequestCommandSettings()
{
Expand Down Expand Up @@ -227,10 +215,7 @@ public override async Task ContinueRequestWithResponse(HttpRequestData requestDa
/// <exception cref="ArgumentNullException">If <paramref name="requestData"/> is <see langword="null"/>.</exception>
public override async Task ContinueRequestWithoutModification(HttpRequestData requestData)
{
if (requestData is null)
{
throw new ArgumentNullException(nameof(requestData));
}
ArgumentNullException.ThrowIfNull(requestData);

await fetch.ContinueRequest(new ContinueRequestCommandSettings() { RequestId = requestData.RequestId }).ConfigureAwait(false);
}
Expand Down Expand Up @@ -281,10 +266,7 @@ await fetch.ContinueWithAuth(new ContinueWithAuthCommandSettings()
/// <exception cref="ArgumentNullException">If <paramref name="responseData"/> is <see langword="null"/>.</exception>
public override async Task AddResponseBody(HttpResponseData responseData)
{
if (responseData is null)
{
throw new ArgumentNullException(nameof(responseData));
}
ArgumentNullException.ThrowIfNull(responseData);

// If the response is a redirect, retrieving the body will throw an error in CDP.
if (responseData.StatusCode < 300 || responseData.StatusCode > 399)
Expand Down Expand Up @@ -312,10 +294,7 @@ public override async Task AddResponseBody(HttpResponseData responseData)
/// <exception cref="ArgumentNullException">If <paramref name="responseData"/> is <see langword="null"/>.</exception>
public override async Task ContinueResponseWithoutModification(HttpResponseData responseData)
{
if (responseData is null)
{
throw new ArgumentNullException(nameof(responseData));
}
ArgumentNullException.ThrowIfNull(responseData);

await fetch.ContinueResponse(new ContinueResponseCommandSettings() { RequestId = responseData.RequestId }).ConfigureAwait(false);
}
Expand Down
35 changes: 7 additions & 28 deletions dotnet/src/webdriver/DevTools/v142/V142Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ public override async Task DisableFetch()
/// <exception cref="ArgumentNullException">If <paramref name="userAgent"/> is null.</exception>
public override async Task SetUserAgentOverride(UserAgent userAgent)
{
if (userAgent is null)
{
throw new ArgumentNullException(nameof(userAgent));
}
ArgumentNullException.ThrowIfNull(userAgent);

await network.SetUserAgentOverride(new SetUserAgentOverrideCommandSettings()
{
Expand All @@ -139,10 +136,7 @@ await network.SetUserAgentOverride(new SetUserAgentOverrideCommandSettings()
/// <exception cref="ArgumentNullException">If <paramref name="requestData"/> is <see langword="null"/>.</exception>
public override async Task ContinueRequest(HttpRequestData requestData)
{
if (requestData is null)
{
throw new ArgumentNullException(nameof(requestData));
}
ArgumentNullException.ThrowIfNull(requestData);

var commandSettings = new ContinueRequestCommandSettings()
{
Expand Down Expand Up @@ -179,15 +173,9 @@ public override async Task ContinueRequest(HttpRequestData requestData)
/// <exception cref="ArgumentNullException">If <paramref name="requestData"/> or <paramref name="responseData"/> are <see langword="null"/>.</exception>
public override async Task ContinueRequestWithResponse(HttpRequestData requestData, HttpResponseData responseData)
{
if (requestData is null)
{
throw new ArgumentNullException(nameof(requestData));
}
ArgumentNullException.ThrowIfNull(requestData);

if (responseData is null)
{
throw new ArgumentNullException(nameof(responseData));
}
ArgumentNullException.ThrowIfNull(responseData);

var commandSettings = new FulfillRequestCommandSettings()
{
Expand Down Expand Up @@ -227,10 +215,7 @@ public override async Task ContinueRequestWithResponse(HttpRequestData requestDa
/// <exception cref="ArgumentNullException">If <paramref name="requestData"/> is <see langword="null"/>.</exception>
public override async Task ContinueRequestWithoutModification(HttpRequestData requestData)
{
if (requestData is null)
{
throw new ArgumentNullException(nameof(requestData));
}
ArgumentNullException.ThrowIfNull(requestData);

await fetch.ContinueRequest(new ContinueRequestCommandSettings() { RequestId = requestData.RequestId }).ConfigureAwait(false);
}
Expand Down Expand Up @@ -281,10 +266,7 @@ await fetch.ContinueWithAuth(new ContinueWithAuthCommandSettings()
/// <exception cref="ArgumentNullException">If <paramref name="responseData"/> is <see langword="null"/>.</exception>
public override async Task AddResponseBody(HttpResponseData responseData)
{
if (responseData is null)
{
throw new ArgumentNullException(nameof(responseData));
}
ArgumentNullException.ThrowIfNull(responseData);

// If the response is a redirect, retrieving the body will throw an error in CDP.
if (responseData.StatusCode < 300 || responseData.StatusCode > 399)
Expand Down Expand Up @@ -312,10 +294,7 @@ public override async Task AddResponseBody(HttpResponseData responseData)
/// <exception cref="ArgumentNullException">If <paramref name="responseData"/> is <see langword="null"/>.</exception>
public override async Task ContinueResponseWithoutModification(HttpResponseData responseData)
{
if (responseData is null)
{
throw new ArgumentNullException(nameof(responseData));
}
ArgumentNullException.ThrowIfNull(responseData);

await fetch.ContinueResponse(new ContinueResponseCommandSettings() { RequestId = responseData.RequestId }).ConfigureAwait(false);
}
Expand Down
Loading
Loading