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]: Handle non-US keyboards in sendKeys in Chrome with Remote Debugging #14551

Open
MilanKarapandzic opened this issue Oct 2, 2024 · 1 comment

Comments

@MilanKarapandzic
Copy link

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

Copy link

github-actions bot commented Oct 2, 2024

@MilanKarapandzic, 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!

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

2 participants