Interaction

Send String

Simulate typing text into a page.

Simulate typing text into a page.

Iterates over each character in the provided text and dispatches synthetic keyboard events (keydown, keypress, keyup) for each character. If Shift is active, the text is converted to uppercase before processing. This mimics user typing behavior at the document level. Inter-character pacing is controlled by GPAL.TypingDelay (set via GPAL.WithTypingDelay, default 0): when 0, the whole string is sent as fast as possible; when greater than 0, every engine (Hardware, Selenium, Puppeteer, OttoMagic) dispatches one character at a time, sleeping a random duration between Math.Min(25, TypingDelay) and TypingDelay milliseconds before each character - TypingDelay is a ceiling on that random range, not a fixed pause.

TIP

SendString is the only typing primitive that honors GPAL.TypingDelay - use it when the target field reacts to individual keystrokes (autocomplete, input masks, JS keyup validation) or when the interaction needs to look human. FillInAppend/FillInInsert/FillInOverwrite set the value directly and stay atomic regardless of TypingDelay; their own optional delayMs only paces a per-character fallback used if the fast-path assignment fails.

Examples

GPAL Fluent: High-level fluent C# API

GPAL.WithTypingDelay(50); // random 25-50ms delay between characters on every engine browser.SendString(string textToSend);

MagicHelper: MagicHelper utility library

GPAL.MagicHelper.SendString(string text, int delayMs = 0);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.SendString(string text, int delayMs = 0).Execute();

Puppeteer Communicator: Low-level communicator

//When delayMs is 0, PuppeteerCommunicator.SendString uses a bulk Input.insertText call. When delayMs is greater than 0, it dispatches Input.dispatchKeyEvent keyDown/keyUp pairs one character at a time via DispatchTextCharByChar, sleeping delayMs between characters.

await browser.PuppeteerCommunicator.SendString(string text, int delayMs = 0, string sessionId = null);

REST Client: Direct REST/HTTP client

GPAL.OttoMagicClient.WithEndpoint(ApiEndpoint.SendString).WithText(string text).SetParameter("typingDelay", 50).Execute();