Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Tests fail when using Selenium Grid on Windows with Turkish language #14916

Closed
alpakyol opened this issue Dec 19, 2024 · 5 comments
Closed

Comments

@alpakyol
Copy link

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

error

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

Copy link

@alpakyol, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@joerg1985
Copy link
Member

@alpakyol thanks for the detailed report, i have visited all relevant calls to .toLowerCase and .toUpperCase in cc5ca35. The x-registration-secret header should be fixed in the next release, but i am not sure of the state in .NET so i will keep this issue open.

@nvborisenko could you check the .NET part or does .NET ignore the system local for .toLowerCase and .toUpperCase calls?

@Delta456
Copy link
Contributor

Is this the case with other bindings like Python and Ruby?

@nvborisenko
Copy link
Member

I think it is Grid only related issue.

@joerg1985
Copy link
Member

In this case i will close the issue, thanks for the fast feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants