- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.6k
 
Description
What happened?
I'm working on an implementation of Selenium Grid to my current test project but I always get this problem while running tests over Selenium Grid. The RemoteWebDriver initializes correctly, can start a browser window, can navigate to a URL without problem. However, when I try to find an element, I'm always getting invalid header name: "x-regıstratıon-secret" error. I created this sample code to reproduce this error so, this is the only code that the test project has. An important note: 'ı' is a special character in Turkish alphabet so, I think it may be related with some language specific problem in somewhere (windows, chrome, webdriver, etc.)
Update: After I check the problem definition, I changed the OS language to English, ran the test again and it succeeded. So, it is definitely a problem with the language. I did one more testing with the chrome option argument '--lang=tr' and again no problem.
Some notes about my environment:
- I'm running tests on Visual Studio 2022 (v17.12.3) however, I also tried VS Code with C# Dev Kit (v1.14.14). Both these two IDEs on English language.
 - I'm using Windows 11 with Turkish language option. It's recently updated.
 - Chrome version is 131. It has normally English but the tests fire with Turkish language (probably because of the system language) so, I added language argument in the code.
 - CLI code of the Selenium Grid is: 'java -jar selenium-server-4.27.0.jar standalone'. I tried hub version but I'm getting the same error at the same place again. I also tried applying 'X-REGISTRATION-SECRET' to both hub and node but nothing has changed.
 - JDK version is 23.0.1
 
How can we reproduce the issue?
[Test]
public void Test1()
{
    ChromeOptions options = new();
    options.AddArguments("--lang=en_US");
    var driver = new RemoteWebDriver(new Uri("http://localhost:4444"), options);
    
    driver.Navigate().GoToUrl("https://www.google.com");
    
    Thread.Sleep(3000);
    try
    {
        driver.FindElement(By.TagName("body"));
    }
    catch (Exception)
    {
        throw;
    }
    finally
    {
        driver.Quit();
    }
}Relevant log output
Error on the test project:
OpenQA.Selenium.WebDriverException
  HResult=0x80131500
  Message=invalid header name: "x-regıstratıon-secret"
  Source=WebDriver
  StackTrace:
   at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
   at OpenQA.Selenium.WebDriver.<ExecuteAsync>d__63.MoveNext()
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.FindElement(String mechanism, String value)
   at OpenQA.Selenium.By.<.ctor>b__11_0(ISearchContext context)
   at OpenQA.Selenium.By.FindElement(ISearchContext context)
   at OpenQA.Selenium.WebDriver.FindElement(By by)
   at TestProject1.Tests.Test1() in C:\Users\Test\source\repos\TestProject1\TestProject1\UnitTest1.cs:line 22
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Error on the CLI:
WARN [SeleniumSpanExporter$1.lambda$export$1] - java.lang.IllegalArgumentException: invalid header name: "x-regıstratıon-secret"
	at java.net.http/jdk.internal.net.http.common.Utils.newIAE(Utils.java:378)
	at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.checkNameAndValue(HttpRequestBuilderImpl.java:107)
	at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.header(HttpRequestBuilderImpl.java:126)
	at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.header(HttpRequestBuilderImpl.java:43)
	at org.openqa.selenium.remote.http.jdk.JdkHttpMessages.lambda$createRequest$2(JdkHttpMessages.java:100)
	at org.openqa.selenium.remote.http.HttpMessage.lambda$forEachHeader$0(HttpMessage.java:74)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
	at org.openqa.selenium.remote.http.HttpMessage.lambda$forEachHeader$1(HttpMessage.java:74)
	at java.base/java.util.HashMap.forEach(HashMap.java:1430)
	at org.openqa.selenium.remote.http.HttpMessage.forEachHeader(HttpMessage.java:74)
	at org.openqa.selenium.remote.http.HttpRequest.forEachHeader(HttpRequest.java:27)
	at org.openqa.selenium.remote.http.jdk.JdkHttpMessages.createRequest(JdkHttpMessages.java:94)
	at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute0(JdkHttpClient.java:454)
	at org.openqa.selenium.remote.http.AddSeleniumUserAgent.lambda$apply$0(AddSeleniumUserAgent.java:42)
	at org.openqa.selenium.remote.http.Filter.lambda$andFinally$1(Filter.java:55)
	at org.openqa.selenium.remote.http.jdk.JdkHttpClient.lambda$executeAsync$1(JdkHttpClient.java:383)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1575)Operating System
Windows 11
Selenium version
.NET 4.27.0
What are the browser(s) and version(s) where you see this issue?
Chrome 130
What are the browser driver(s) and version(s) where you see this issue?
Are you using Selenium Grid?
4.27.0
