How to use Robot.js in C# automation?

  1. It seems unlikely that you want to create a new Diagram in your Mouse_Click.js function. But that is the very first thing your code does.

Instead you should get a reference to the existing Diagram on the page:

var diagramDiv = document.getElementById("myPaletteDiv");
var diagram = go.Diagram.fromDiv(diagramDiv);
  1. A potential problem is that your code would be defining several functions repeatedly, assuming you will be executing multiple steps, and thus multiple scripts. Could you define and load initially all of your common code once before you start executing any tests?