DocsKeyboardCDP Copy Text (Background)

CDP Copy Text Command Reference (Virtual Clipboard)

Browser ModeRunMacro 3.5+

The CDP Copy Text command reads text from a web page in Browser Mode (CDP) and stores it in the virtual clipboard or a variable.

Dialog & quick setup

RunMacro CDP Copy Text (Background) command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the CDP Copy Text (Background) command in RunMacro.
  1. In Browser Mode (CDP), add Keyboard › CDP Copy Text.
  2. Choose the source: selection / selector / focused input.
  3. For selector, enter the selector; set a result variable if needed. Save.

Options reference

Source (selection / selector / focused input)

Where to read text: the selection, an element by selector, or the focused input.

Selector

The CSS selector of the element to read (when source = selector).

Result variable

The variable name to store the text. Leave empty to store only in the virtual clipboard.

Modes & when to use

Browser Mode

Always writes text to the context virtual clipboard and additionally to a variable when configured.

Best for

  • Grab a web element content (price, code, status) to process.
  • Read data in the background without touching the real clipboard.
  • Save text into a variable for a later step.

Use an alternative when

  • The workflow runs only in Desktop Mode.
  • Structured extraction or complex iframe/shadow-DOM handling is required; Smart HTML is more appropriate.
  • The selector is unstable or the target is outside the current CDP page context.
Before you run
  • The workflow runs in Browser Mode with an active CDP driver.
  • Selector source has a valid CSS selector; selection or focused-input source has matching page state.
  • The result variable name is valid when storage beyond the virtual clipboard is needed.

Example workflow

Example: grab a product price

  1. CDP Copy Text: source = selector .price, variable = price.
  2. Use {price} in later steps.
Expected result: Text from the selection, selector, or focused input is written to the virtual clipboard and optionally to the result variable.

Tips & limitations

Runs only in Browser Mode (CDP). This is the background version of Copy Text — use it to grab web data without taking the clipboard/mouse.
  • The command fails outside Browser Mode or without a CDP driver.
  • A missing selector or empty selection can produce an empty string.
  • Iframes, shadow DOM, cross-origin content, or dynamically replaced elements may require different targeting.

Applies to RunMacro 3.5+ · Browser Mode · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.