Using robot.js to simulate clicks, why does text count more and it doesn't work?

I think it may be loc.x + 10, loc.y + 10, 0, parameter problem, but I don’t know how to change it. Thank you for giving the answers

Depending on your node, clicking 10 pixels away from the node’s location might not work. You can try this instead:

function clickNode(key) {
  var node= myDiagram.findNodeForKey(key);
  if (node === null) return;
  var loc = node.getDocumentPoint(go.Spot.Center);

  // click on node
  robot.mouseDown(loc.x, loc.y, 0, { });
  robot.mouseUp(loc.x, loc.y, 100, { });

  // Clicking is just a sequence of input events.
  // There is no command in CommandHandler for such a basic gesture.
}

This will click the center of the given node.