Skip to content

[πŸ› Bug]: Handle non-US keyboards in sendKeys in Chrome with Remote DebuggingΒ #14551

@MilanKarapandzic

Description

@MilanKarapandzic

What happened?

Hi!

When I want to use .net Selenium package with a Chrome browser with Remote Debugging (started with the option "--remote-debugging-port"), I have problems with some special characters in SendKeys, if I select non-US keyboard. If the browser is started without the remote debugging option, this is working properly, probably due to the fix in the issue #4253.

An example of the issue:

  • set the keyboard to "Slovenian"
  • open a web page with an input field using the Chrome browser with the option "--remote-debugging-port"
  • try to write a text "This is @ test" to that field using SendKeys
  • instead of the symbol "@", the input field will contain the clipboard content (probably because the symbol "@" on the Slovenian keyboard can be produced using the combination AltGr + V)

How can we reproduce the issue?

// start the broswer using the command:
//   ".\chrome.exe --remote-debugging-port=9222 --user-data-dir=<profile>"

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;

var optionsChrome = new ChromeOptions
{
    DebuggerAddress = "localhost:9222"
};

var webDriver = new ChromeDriver(ChromeDriverService.CreateDefaultService(), optionsChrome, TimeSpan.FromSeconds(10));

webDriver.Manage().Window.Maximize();
webDriver.Navigate().GoToUrl("https://myqabee.com/");
webDriver.FindElement(By.Id("myModalBtn1")).Click();

Thread.Sleep(1000);

webDriver.FindElement(By.Id("fName")).SendKeys("This is @ test");

Thread.Sleep(2000);

webDriver.FindElement(By.XPath("//*[@id=\"myModal\"]/div/div/div[1]/button")).Click();

Relevant log output

...

[1727866733.105][INFO]: [a3cb224619f1e2a7b97367d35d21d5e3] COMMAND TypeElement {
   "id": "f.D8A1AC54E6E7245E34557A1233F9275B.d.E15662094B285962CB1C5B36ECA55C61.e.1261",
   "text": "This is @ test",
   "value": [ "T", "h", "i", "s", " ", "i", "s", " ", "@", " ", "t", "e", "s", "t" ]
}

...

[1727866733.123][DEBUG]: DevTools WebSocket Command: Input.dispatchKeyEvent (id=142) (session_id=7C7686B1E50BF4F9108F2C203D5890E2) D8A1AC54E6E7245E34557A1233F9275B {
   "code": "KeyV",
   "commands": [ "Paste" ],
   "key": "v",
   "modifiers": 3,
   "text": "@",
   "type": "rawKeyDown",
   "unmodifiedText": "v",
   "windowsVirtualKeyCode": 86
}
[1727866733.123][DEBUG]: DevTools WebSocket Command: Input.dispatchKeyEvent (id=143) (session_id=7C7686B1E50BF4F9108F2C203D5890E2) D8A1AC54E6E7245E34557A1233F9275B {
   "code": "KeyV",
   "commands": [ "Paste" ],
   "key": "v",
   "modifiers": 3,
   "text": "@",
   "type": "char",
   "unmodifiedText": "v",
   "windowsVirtualKeyCode": 86
}
[1727866733.123][DEBUG]: DevTools WebSocket Command: Input.dispatchKeyEvent (id=144) (session_id=7C7686B1E50BF4F9108F2C203D5890E2) D8A1AC54E6E7245E34557A1233F9275B {
   "code": "KeyV",
   "commands": [ "Paste" ],
   "key": "v",
   "modifiers": 3,
   "text": "@",
   "type": "keyUp",
   "unmodifiedText": "v",
   "windowsVirtualKeyCode": 86
}

Operating System

Windows 11

Selenium version

.net Selenium.WebDriver 4.25.0

What are the browser(s) and version(s) where you see this issue?

Google Chrome 129.0.6668.71

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 129.0.6668.70

Are you using Selenium Grid?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-dotnet.NET BindingsG-chromedriverRequires fixes in ChromeDriverI-defectSomething is not working as intendedJ-staleApplied to issues that become stale, and eventually closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions