Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-platform implementation of SendKeys in C#?

I need to automate desktop applications (not a web browser) testing on Windows, Mac and Linux. On Windows I use SendKeys, what do I use on Mac and Linux? Are there any cross-platform .NET Core SendKeys implementation that I can preferably use from xUnit?

like image 752
IT Hit WebDAV Avatar asked Jan 16 '18 07:01

IT Hit WebDAV


People also ask

How do I send keystrokes to another app?

There are two methods to send keystrokes to an application: SendKeys. Send and SendKeys. SendWait. The difference between the two methods is that SendWait blocks the current thread when the keystroke is sent, waiting for a response, while Send doesn't.

How do you send SendKeys?

To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)".

How does net core work cross-platform?

NET Core is cross-platform. It runs on Windows, OS X and multiple distributions of Linux. It also supports different CPU architectures. We're adding more Linux distribution and CPU architecture support with the eventual goal of .

How do I use SendKeys SendWait?

Use SendWait to send keystrokes or combinations of keystrokes to the active application and wait for the keystroke messages to be processed. You can use this method to send keystrokes to an application and wait for any processes that are started by the keystrokes to be completed.


1 Answers

I am developing a library that does exactly this.

https://github.com/lucassklp/Desktop.Robot

like image 117
Lucas Simas Avatar answered Oct 13 '22 21:10

Lucas Simas