Winappdriver: SendKeys is incredibly slow on a WinForms app

Created on 3 Mar 2017  Â·  8Comments  Â·  Source: microsoft/WinAppDriver

I'm writing a few lines of text to a multi-line text box on a WinForms app. This takes a very long time, as the pauses between each key press are long. It seems to be ~5 times slower than typing the exact same string into an Android device.

Is there any way to set the text faster ? I am not interested in simulating an actual user, so actually setting the whole string at once would be ok.

Bug

Most helpful comment

+1

All 8 comments

I've noticed this as well, marking as a bug for us to investigate. Thanks.

Do we have an update on this issue? Is there a roadmap to support a different sendKeyStrategy?

Looking at this some more, it takes approximately 100 ms per extra key stroke that is entered (with an initial overhead of ~225 ms).

It's as if there is an intentional sleep/wait of 50–100ms with each key stroke. If this is true could this not be configurable as a capability? Typing a 100 character long string can take >10 seconds where as on iOS and Android this takes less than 2 seconds to type.

Our tests which run on Windows take much longer to run largely because of this!

Sample timing code

// element is "Text Editor" element of notepad.exe
var stopwatch = new Stopwatch();
for (var i = 1; i < 50; i++)
{
    stopwatch.Restart();
    element.SendKeys(new string('.', i));
    timings.Add(i, stopwatch.Elapsed);
}
stopwatch.Stop();

Results (click to expand)

Length Time /ms

1 324.3621
2 426.4828
3 526.5173
4 625.7351
5 731.2946
6 832.9059
7 939.4098
8 1042.0187
9 1141.0083
10 1237.2658
11 1340.3266
12 1444.7836
13 1545.7972
14 1649.2756
15 1745.3433
16 1847.0165
17 1955.1851
18 2048.8625
19 2147.1372
20 2252.4429
21 2352.5703
22 2456.1842
23 2557.2057
24 2657.7625
25 2760.5310
26 2861.5971
27 2955.2763
28 3058.7034
29 3160.2129
30 3269.7398
31 3366.3996
32 3469.3434
33 3570.7307
34 3666.7676
35 3767.4056
36 3869.9400
37 3971.6589
38 4069.4574
39 4175.2876
40 4279.8255
41 4378.7431
42 4476.8069
43 4579.4885
44 4680.3207
45 4783.8319
46 4882.2591
47 4974.5354
48 5077.6845
49 5183.5658

We recently made an improvement on typing and clicking input performance in v1.0-RC2 release. Would you please give it a try?

Still facing this problem in release 1.1

+1

+1

it's not just WinForms, it's SendKeys in general, even in Notepad it's incredibly slow. It should be as fast as a copy/paste operation, not normal human typing speed, imo. AutoIt seems more instantaneous. Is there no way to "Paste" a string into a textbox, is SendKeys the only way? Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hassanuz picture hassanuz  Â·  4Comments

sandeepdroid picture sandeepdroid  Â·  3Comments

ant-skelia picture ant-skelia  Â·  4Comments

bharathp666 picture bharathp666  Â·  3Comments

quincycs picture quincycs  Â·  3Comments