標籤:c# sendkeys.send sendkeys.sendwait
SendKeys.Send: Sends keystrokes to the active application. That‘s all.
SendKeys.SendWait: Sends the given keys to the active application, and then waits for the messages to be processed.
So, 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. This can be important if the other application must finish before your application can continue.
For example, if your webpage need to install a xxx.msi to continue, when the webpage pops up a bottom bar to install xxx.msi, you should use SendKeys.SendWait to trigger the installation, not SendKeys.Send.
C# - The differences between SendKeys.Send and SendKeys.SendWait