Interaction

Press Modifier Key

Track and simulate keyboard modifier key states.

Track and simulate keyboard modifier key states.

Checks which modifier keys (Control, Shift, Alt, Windows/Meta, ScrollLock, Application) are active.For each detected modifier, it prepares corresponding synthetic keyboard event data (left and right variants) intended for dispatch, enabling the system to simulate or track modifier key presses during automated input handling.

TIP

Valid modifiers are as such: NONE, Alt, Control, Windows, Shift, Application, ScrollLock All engines accept combined (ORd) ModifierKeys values, e.g. ModifierKeys.Control | ModifierKeys.Shift. Hardware (keybd_event) and OttoMagic support all six flags including Application and ScrollLock. Selenium (WebDriver Actions) and Puppeteer (CDP modifiers bitmask) support Alt, Control, Shift and Windows (mapped to Meta/Command); Application and ScrollLock have no Selenium Actions or CDP equivalent and are ignored with a WARNING event on those paths.

Examples

GPAL Fluent: High-level fluent C# API

browser.PressModifierKey(ModifierKeys.Control | ModifierKeys.Shift)

MagicHelper: MagicHelper utility library

GPAL.MagicHelper.PressModifierKey(ModifierKeys modifierKeys);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.PressModifierKey(ModifierKeys modifierKeys).Execute();

Puppeteer Communicator: Low-level communicator

//Should use helper PuppeteerClient.GetModifierBitmask(modifierKeys) to get the int modifierkeys used by CDP

await browser.PuppeteerCommunicator.PressModifierKey(int modifierKeys, string sessionId);

REST Client: Direct REST/HTTP client

GPAL.OttoMagicClient.PressModifierKey(ModifierKeys modifierKeys).Execute();