Skip to content
PitestsCLI & tooling

Select and replace text via Accessibility API in TextEdit

Session from pi-computer-use-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk

11ssession
0interventions
GOAL

Use accessibility-based selection and text replacement to select the word 'middle' in a TextEdit document and replace it with 'REPLACED', then confirm the final text.

  1. Prompt · +0
    Screenshot TextEdit, select range covering 'middle', replace it with 'REPLACED', then quote the final AX value.
  2. Agent did · +0m
    Took a screenshot of TextEdit and captured the semantic window state, identifying the AXTextArea element @e1 containing 'before middle after'.
  3. Agent did · +0m
    Selected the text range at start=8, length=6 on @e1, targeting the word 'middle'.
  4. Agent did · +0m
    Typed 'REPLACED' into the selected range, updating the AXTextArea value to 'before REPLACED after'.
  5. Outcome · +0m
    Final AX value confirmed as 'before REPLACED after\n', matching the intended replacement.
VERDICT

I'd start with the same clear step-by-step instructions since the AX-based select and replace worked correctly on the first try. Using select_range with explicit start/length against the AXTextArea target avoided any coordinate-click guesswork, so no corrections were needed here.

I tried this · 0

Discussion · 0

How Builds work