Winappdriver: 'SendKeys' do not enter all characters

Created on 4 Jul 2018  路  4Comments  路  Source: microsoft/WinAppDriver

Hi all,
I have a lot of situation when 'sendKeys' do not enter all characters and that is the reason why the tests failed.
Do you have some solution or workaround?
it is difficult to trace, but the problem really EXIST.

Enhancement

Most helpful comment

Hi, we have a similar problem... if we invoke SendKeys with some text (e.g. element.SendKeys("This is sample text")) we see in the application that sometimes this works, and sometimes it is missing a letter or two. It has been hard to establish a pattern. It appears that we can workaround the problem by invoking SendKeys for each individual character in the string, which of course is a bit slower.

All 4 comments

Hi @ant-skelia, we're looking into adding improvements for sendkeys in the backlog for future WAD release - can you provide any particular example for your scenario?

Hi, we have a similar problem... if we invoke SendKeys with some text (e.g. element.SendKeys("This is sample text")) we see in the application that sometimes this works, and sometimes it is missing a letter or two. It has been hard to establish a pattern. It appears that we can workaround the problem by invoking SendKeys for each individual character in the string, which of course is a bit slower.

Hi @mdesousa, @ant-skelia,

The SendKeys endpoint will inject the key input into whatever element that has the keyboard focus (or to the specified element in the case of element.SendKeys) the same way with how we manually type on the keyboard attached to the test machine. What likely happened was that the key input took place so quickly before the target element gained the keyboard focus and hence some of the key input was injected to the wrong element that previously had the focus. At the moment, a workaround would be to enforce focus on the target element through clicking and introduce a small delay before sending keys.

Not sure that is what is happening here, because we normally see the text disappearing in the middle.
For example, the code below resulted in the first "i" being skipped from Line 1. Sometimes running the same code results in different sections or letters being stripped.

richTextEditor.Click();
richTextEditor.SendKeys("This is normal text" + Keys.Enter);
WindowsDriver.FindElementByNameAndClick("Bold");
richTextEditor.SendKeys("This is bold text" + Keys.Enter);

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jsa34 picture jsa34  路  3Comments

sandeepdroid picture sandeepdroid  路  3Comments

viji-123 picture viji-123  路  4Comments

didhddldlq picture didhddldlq  路  3Comments

sky205 picture sky205  路  3Comments