Browse the docs

Click

Clicks an element, a picture on screen, or a position, with the left, right or middle button.

Click locator

Keyboard Maestro: MouseMoveAndClick

Details #

Click has three ways to say where to click. Use the first one that fits.

  1. An element (locator). You point at a button, field or menu item and Switchboard finds it again by what it is: its role, title, identifier and place in the window. It waits for the element to appear and to be enabled, up to the step's timeout. A plain left click on an element that supports pressing uses the accessibility "press" action, with no mouse movement. Any other click moves the real pointer to the element's center.

  2. A picture (a locator with an image). Switchboard looks for the picture on screen or in the front window and clicks its center.

  3. A position (position). Plain coordinates, measured from the screen, the front window or the current pointer.

When no element matches, three things are tried before the step fails. If the app exposes no accessibility tree and the locator has a title, Switchboard reads the window with text recognition and clicks the text it finds. Otherwise, if the locator has a recorded fallback position and the window is the size it was when recorded, that position is used. Then the step fails and the Trace lists what it looked for, what was there, and the nearest match.

Confidence: a match under 70% fails. A match from 70% to 85% is clicked, with the warning "low confidence" in the Trace.

Select the step and press Re-record in the editor, then click the element, or Record the click with ⇧⌘R. The locator's fields:

Where to look

Save button

In Switchboard, Pick an element fills this in for you.

The output says what was clicked, how sure the match was, and the method used (press, mouse, position, ocr, image, move).

Parameters #

ParameterTypeRequiredValuesWhat it does
apptextThe app to look in, by bundle id. Defaults to the app named in the locator, otherwise the front app.
buttonone ofleft right middleleft (default), right or middle.
countwhole numberNumber of clicks, 0 to 3; the default is 1. 2 is a double click. 0 only moves the pointer.
fuzzyyes / noFor element clicks, accepts a match between 40% and 70% instead of failing. It is flagged "fuzzy match" in the Trace.
locatorlocatorThe element or picture to click. Without it, position is required.
modifierslist ofcmd ctrl opt shift fn hyperKeys held during the click, from cmd, ctrl, opt, shift, fn, hyper.
positionrecordcorner relativeTo x yx and y, with relativeTo set to screen (the default), window (the front window) or mouse (the current pointer). corner (TopLeft, TopRight, BottomLeft, BottomRight, Center) says which corner the offset is measured from; the default is TopLeft. For screen the corner is a corner of the main screen and Center measures from its middle. With mouse the corner is ignored. On a picture click, position is an offset from the found picture instead (default corner Center).
restoreyes / noFor picture clicks, moves the pointer back to where it was afterwards.
waitnumberFor picture clicks, how many seconds to keep looking. 0 looks once. By default it keeps looking for the step's timeout.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Click the Save button in the front app (really clicks)
Do
  1. Click Save button
Open in Switchboard to try it

A right click 20 points in from the top left of the front window:

Right-click near the top of the window (really clicks)
Do
  1. Right-click at (20, 20)
Open in Switchboard to try it

Gotchas #

  • A dry run skips this step. If you mark it Safe in dry run, the element is found and reported in the Trace, but never clicked.

  • Coordinates start at the top left of the screen (or window).

  • macOS must allow Switchboard to control your computer (Accessibility) for element and mouse steps. Text recognition and picture clicks also need Screen Recording. The Trace names the missing permission.

  • Positions break when windows move. Prefer an element.

See also #

Wait, Set field value, Read field value, Move pointer by, Drag mouse, Scroll