WinAppDriver
WinAppDriver copied to clipboard
SendKeys not always send correct keys (if keyboard differs (Swedish, English))
- Define the datetime as string: string date = DateTime.Now.ToShortDateString();
- sendKeys for some text control: someWindowsElementTextControl.SendKeys(date); Actual result: Depending on windows culture it will send different data, for example: Swedish environment with dateTime format yyyy-mm-dd: 2018+10+09 English environment with dateTime format mm/dd/yyyy: 10/09/2018
Expected result: As far as I understand SendKeys() should send the exact keys which are on the 'string' variable. doesn't matter which culture it is (Swedish or English).
Additional info: If we use ToShortDateString() for both cultures it will work for English and probably other cultures but not for Swedish. So we have a workaround for now: ToShortDateString().Replace("-", string.Empty);
Hi @Soloveykos,
This is as expected, currently we only support the US keyboard. We've marked this as a potential future enhancement.
FYI duplicate of/related to https://github.com/Microsoft/WinAppDriver/issues/215
When it comes to UI testing, relevance of culture environment and keyboard layout are emphasized. Hence, shouldn't this strong restriction be mentioned a bit more prominent - say on the intro page? Not at least this is likely to be a show stopper for many outside US who need to test in their native culture settings and moreover it's harsh to learn about this issue perhaps after investing in convincing decider, introducing developer and creating test suites containing cases that maybe exotic for US but relevant in foreign context. Btw, running the WinAppDriver unit tests suite in non-US environment settings breaks every related test, which appears to be expected after what I've learned here.
Any other alternative to this sendkeys ? It often fails on azure pipelines agent windows-2019. can we install winappdriver release using commad line so we can install specific version on pipeline agent?
The problem is that WinAppDriver (actually WebDriver) conflates keys (WM_KEYDOWN
) and text (WM_CHAR
). We're missing an api to send "untranslated" text to the target process (ie without involving the TranslateMessage
win32 API).