Share via


Keyboard Class

Provides static methods for performing automated keyboard actions.

Inheritance Hierarchy

Object
  Microsoft.VisualStudio.TestTools.UITesting.Keyboard

Namespace:  Microsoft.VisualStudio.TestTools.UITesting
Assembly:  Microsoft.VisualStudio.TestTools.UITesting (in Microsoft.VisualStudio.TestTools.UITesting.dll)

Syntax

'Declaration
<CLSCompliantAttribute(True)> _
Public Class Keyboard _
    Implements IDisposable
[CLSCompliantAttribute(true)]
public class Keyboard : IDisposable
[CLSCompliantAttribute(true)]
public ref class Keyboard : IDisposable
[<CLSCompliantAttribute(true)>]
type Keyboard =  
    class 
        interface IDisposable 
    end
public class Keyboard implements IDisposable

The Keyboard type exposes the following members.

Constructors

  Name Description
Protected method Keyboard Infrastructure. Initializes a new instance of the Keyboard class.

Top

Properties

  Name Description
Public propertyStatic member Instance Gets or sets the keyboard instance.
Public propertyStatic member SendKeysDelay Gets or sets the time to wait between sending keystrokes to the application.

Top

Methods

  Name Description
Public method Dispose() Releases all resources that are used by the current instance of the Keyboard class.
Protected method Dispose(Boolean) Releases the unmanaged resources that are used by the Keyboard and optionally releases the managed resources.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Releases unmanaged resources and performs other cleanup operations before this Keyboard instance is reclaimed by garbage collection. (Overrides Object.Finalize.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public methodStatic member PressModifierKeys(ModifierKeys) Presses the specified modifier keys without releasing them.
Public methodStatic member PressModifierKeys(UITestControl, ModifierKeys) Presses the specified modifier keys in the given control without releasing them.
Protected method PressModifierKeysImplementation Presses the specified modifier keys without releasing them.
Public methodStatic member ReleaseModifierKeys(ModifierKeys) Releases the specified keys that were previously pressed by using the PressModifierKeys method.
Public methodStatic member ReleaseModifierKeys(UITestControl, ModifierKeys) Releases the specified keys that were previously pressed by using the PressModifierKeys method in the given control.
Protected method ReleaseModifierKeysImplementation Infrastructure. Presses the specified modifier keys in the given control without releasing them.
Public methodStatic member SendKeys(String) Sends keystrokes to generate the specified text string.
Public methodStatic member SendKeys(String, Boolean) Sends keystrokes to generate the specified text string.
Public methodStatic member SendKeys(String, ModifierKeys) Sends keystrokes to generate the specified text string.
Public methodStatic member SendKeys(UITestControl, String) Sends keystrokes to generate the specified text string.
Public methodStatic member SendKeys(String, ModifierKeys, Boolean) Sends keystrokes to generate the specified text string.
Public methodStatic member SendKeys(UITestControl, String, Boolean) Sends keystrokes to generate the specified text string.
Public methodStatic member SendKeys(UITestControl, String, ModifierKeys) Sends keystrokes to the provided control to generate the specified text string by using the provided modifier keys.
Public methodStatic member SendKeys(String, ModifierKeys, Boolean, Boolean) Sends keystrokes to the provided control to generate the specified text string using the provided modifier keys and indicators for encoding and unicode.
Public methodStatic member SendKeys(UITestControl, String, ModifierKeys, Boolean) Sends keystrokes to the provided control to generate the specified text string using the provided modifier keys and encoding indicator.
Public methodStatic member SendKeys(UITestControl, String, ModifierKeys, Boolean, Boolean) Sends keystrokes to the provided control to generate the specified text string by using the provided modifier keys and indicators for encoding and unicode.
Protected method SendKeysImplementation
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.TestTools.UITesting Namespace