From e194c766a682910673714afe89bcbd3562dcf12d Mon Sep 17 00:00:00 2001
From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com>
Date: Thu, 13 Nov 2025 21:33:24 +0300
Subject: [PATCH 1/3] Upgrade rules_dotnet to 0.20.5
---
MODULE.bazel | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MODULE.bazel b/MODULE.bazel
index 940d4a87b4982..5c3919a6eac04 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -17,7 +17,7 @@ bazel_dep(name = "protobuf", version = "29.2", dev_dependency = True, repo_name
# Required for rules_rust to import the crates properly
bazel_dep(name = "rules_cc", version = "0.2.8", dev_dependency = True)
-bazel_dep(name = "rules_dotnet", version = "0.17.5")
+bazel_dep(name = "rules_dotnet", version = "0.20.5")
bazel_dep(name = "rules_java", version = "8.7.1")
bazel_dep(name = "rules_jvm_external", version = "6.8")
bazel_dep(name = "rules_multitool", version = "1.3.0")
From 2dbf9c177d8d4e73db3bb75f6180ed861bee8d32 Mon Sep 17 00:00:00 2001
From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com>
Date: Thu, 13 Nov 2025 22:50:03 +0300
Subject: [PATCH 2/3] Assembly name as part of resource name
---
dotnet/src/webdriver/Internal/ResourceUtilities.cs | 1 +
dotnet/src/webdriver/Selenium.WebDriver.csproj | 10 +++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/dotnet/src/webdriver/Internal/ResourceUtilities.cs b/dotnet/src/webdriver/Internal/ResourceUtilities.cs
index 06c04389e5e92..3d8c18037bd34 100644
--- a/dotnet/src/webdriver/Internal/ResourceUtilities.cs
+++ b/dotnet/src/webdriver/Internal/ResourceUtilities.cs
@@ -101,6 +101,7 @@ public static Stream GetResourceStream(string fileName, string resourceId)
}
Assembly executingAssembly = Assembly.GetExecutingAssembly();
+ resourceId = $"{executingAssembly.GetName().Name}.{resourceId}";
resourceStream = executingAssembly.GetManifestResourceStream(resourceId);
}
diff --git a/dotnet/src/webdriver/Selenium.WebDriver.csproj b/dotnet/src/webdriver/Selenium.WebDriver.csproj
index 69b2b398e3532..6cee5f837ea24 100644
--- a/dotnet/src/webdriver/Selenium.WebDriver.csproj
+++ b/dotnet/src/webdriver/Selenium.WebDriver.csproj
@@ -85,23 +85,23 @@
False
- webdriver_prefs.json
+ $(AssemblyName).webdriver_prefs.json
False
- get-attribute.js
+ $(AssemblyName).get-attribute.js
False
- is-displayed.js
+ $(AssemblyName).is-displayed.js
False
- find-elements.js
+ $(AssemblyName).find-elements.js
False
- mutation-listener.js
+ $(AssemblyName).mutation-listener.js
From 89f6b016549c0e0c399c71fbdcd17661f02cc1c7 Mon Sep 17 00:00:00 2001
From: Nikolay Borisenko <22616990+nvborisenko@users.noreply.github.com>
Date: Thu, 13 Nov 2025 23:00:02 +0300
Subject: [PATCH 3/3] Don't change public behavior
---
dotnet/src/webdriver/Firefox/FirefoxExtension.cs | 3 ++-
dotnet/src/webdriver/Firefox/FirefoxProfile.cs | 3 ++-
dotnet/src/webdriver/Internal/ResourceUtilities.cs | 1 -
dotnet/src/webdriver/JavaScriptEngine.cs | 3 ++-
dotnet/src/webdriver/RelativeBy.cs | 3 ++-
dotnet/src/webdriver/WebElement.cs | 3 ++-
6 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dotnet/src/webdriver/Firefox/FirefoxExtension.cs b/dotnet/src/webdriver/Firefox/FirefoxExtension.cs
index 8c23fcd07c6dd..11a97c8c01e83 100644
--- a/dotnet/src/webdriver/Firefox/FirefoxExtension.cs
+++ b/dotnet/src/webdriver/Firefox/FirefoxExtension.cs
@@ -22,6 +22,7 @@
using System.Globalization;
using System.IO;
using System.IO.Compression;
+using System.Reflection;
using System.Text.Json.Nodes;
using System.Xml;
@@ -88,7 +89,7 @@ public void Install(string profileDirectory)
// First, expand the .xpi archive into a temporary location.
Directory.CreateDirectory(tempFileName);
- Stream zipFileStream = ResourceUtilities.GetResourceStream(this.extensionFileName, this.extensionResourceId);
+ Stream zipFileStream = ResourceUtilities.GetResourceStream(this.extensionFileName, $"{Assembly.GetExecutingAssembly().GetName().Name}.{this.extensionResourceId}");
using (ZipArchive extensionZipArchive = new ZipArchive(zipFileStream, ZipArchiveMode.Read))
{
extensionZipArchive.ExtractToDirectory(tempFileName);
diff --git a/dotnet/src/webdriver/Firefox/FirefoxProfile.cs b/dotnet/src/webdriver/Firefox/FirefoxProfile.cs
index ad25a78b0727a..0af71b5d9c014 100644
--- a/dotnet/src/webdriver/Firefox/FirefoxProfile.cs
+++ b/dotnet/src/webdriver/Firefox/FirefoxProfile.cs
@@ -23,6 +23,7 @@
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.IO.Compression;
+using System.Reflection;
using System.Text.Json;
namespace OpenQA.Selenium.Firefox;
@@ -297,7 +298,7 @@ private void UpdateUserPreferences(string profileDirectory)
private Preferences ReadDefaultPreferences()
{
- using (Stream defaultPrefsStream = ResourceUtilities.GetResourceStream("webdriver_prefs.json", "webdriver_prefs.json"))
+ using (Stream defaultPrefsStream = ResourceUtilities.GetResourceStream("webdriver_prefs.json", $"{Assembly.GetExecutingAssembly().GetName().Name}.webdriver_prefs.json"))
{
using JsonDocument defaultPreferences = JsonDocument.Parse(defaultPrefsStream);
diff --git a/dotnet/src/webdriver/Internal/ResourceUtilities.cs b/dotnet/src/webdriver/Internal/ResourceUtilities.cs
index 3d8c18037bd34..06c04389e5e92 100644
--- a/dotnet/src/webdriver/Internal/ResourceUtilities.cs
+++ b/dotnet/src/webdriver/Internal/ResourceUtilities.cs
@@ -101,7 +101,6 @@ public static Stream GetResourceStream(string fileName, string resourceId)
}
Assembly executingAssembly = Assembly.GetExecutingAssembly();
- resourceId = $"{executingAssembly.GetName().Name}.{resourceId}";
resourceStream = executingAssembly.GetManifestResourceStream(resourceId);
}
diff --git a/dotnet/src/webdriver/JavaScriptEngine.cs b/dotnet/src/webdriver/JavaScriptEngine.cs
index 3465c46b98cbb..3ed08e9fa944c 100644
--- a/dotnet/src/webdriver/JavaScriptEngine.cs
+++ b/dotnet/src/webdriver/JavaScriptEngine.cs
@@ -25,6 +25,7 @@
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text.Json;
using System.Threading.Tasks;
@@ -411,7 +412,7 @@ private async Task EnableDomains()
private static string GetMutationListenerScript()
{
string listenerScript = string.Empty;
- using (Stream resourceStream = ResourceUtilities.GetResourceStream("mutation-listener.js", "mutation-listener.js"))
+ using (Stream resourceStream = ResourceUtilities.GetResourceStream("mutation-listener.js", $"{Assembly.GetExecutingAssembly().GetName().Name}.mutation-listener.js"))
{
using (StreamReader resourceReader = new StreamReader(resourceStream))
{
diff --git a/dotnet/src/webdriver/RelativeBy.cs b/dotnet/src/webdriver/RelativeBy.cs
index 2823b1c6a7f71..dd6335d76b32c 100644
--- a/dotnet/src/webdriver/RelativeBy.cs
+++ b/dotnet/src/webdriver/RelativeBy.cs
@@ -23,6 +23,7 @@
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
+using System.Reflection;
namespace OpenQA.Selenium;
@@ -38,7 +39,7 @@ public sealed class RelativeBy : By
private static string GetWrappedAtom()
{
string atom;
- using (Stream atomStream = ResourceUtilities.GetResourceStream("find-elements.js", "find-elements.js"))
+ using (Stream atomStream = ResourceUtilities.GetResourceStream("find-elements.js", $"{Assembly.GetExecutingAssembly().GetName().Name}.find-elements.js"))
{
using (StreamReader atomReader = new StreamReader(atomStream))
{
diff --git a/dotnet/src/webdriver/WebElement.cs b/dotnet/src/webdriver/WebElement.cs
index 4dba6ae8837f4..8a5c66bdad286 100644
--- a/dotnet/src/webdriver/WebElement.cs
+++ b/dotnet/src/webdriver/WebElement.cs
@@ -27,6 +27,7 @@
using System.IO;
using System.IO.Compression;
using System.Linq;
+using System.Reflection;
namespace OpenQA.Selenium;
@@ -709,7 +710,7 @@ protected virtual Response Execute(string commandToExecute, Dictionary