How to hover mouse on goJS canvas diagram in selenium

I am writing an IT test in selenium to click on a button that appears only when we hover over another button. Attached recording

I have the below function, but for some reason, it is not hovering. The function is wrapped in a java method.

function moveNodeCenter(canvasParent, nodeIndex){
    var canvas = go.Diagram.fromDiv(canvasParent);
    var nodeDataArray = getAllNodes(canvasParent);
    var targetNodeKey = nodeDataArray[nodeIndex].key;
    var targetNodeObj = canvas.findNodeForKey(targetNodeKey);
    var robot = new Robot(canvas);
    robotMove(robot,targetNodeObj.x,targetNodeObj.y);
} 

public void moveNodeCenter(int nodeIndex) throws IOException, InterruptedException {
    WebElement canvasParent = this.getCanvasParent();
    String script = ResourceUtilities.getResource(DESIGNER_SCRIPT_PATH);
    script += "\n moveNodeCenter(arguments[0], arguments[1])";
    js.executeScript(script, canvasParent, nodeIndex);
}

can someone help? or is there any away I could do this? I do see the mouseMove event here: https://gojs.net/latest/extensions/Robot.js

Feb-09-2023 11-03-29

What does robotMove do? Does it call Robot.mouseMove with suitable millisecond numbers to make it think that the mouse has hovered long enough there to trigger the GraphObject.mouseHover event?
Robot | GoJS API
GraphObject | GoJS API

thanks Walter. This is what it is doing

function robotMove(robot, x, y){
	robot.mouseMove(x,y);
}

Yes, you’re going to have to pass appropriate timestamp numbers so that it has reason to think enough time has passed to count as a “hover”.

hmm, I passed

function robotMove(robot, x, y){
	robot.mouseMove(x,y,5000);
}

but it failed. I am able to select the node though, but selecting the node does not display other buttons, those come up only when hovered.

Well, of course if you keep telling it that no time has passed (i.e. the virtual clock is always at 5000 milliseconds), any operations that depend on time passing will fail.

so are you saying i need to increase the time from 5secs to say 30secs?

That argument is a timestamp – basically the virtual time on the clock since the start time (zero). It is not a duration or a delay time.

could you please give me an example?it’d be helpful

Sure, there are a bunch of examples in Simulating Input Events. Look at the functions that are called from the HTML buttons.

thank you!
i tried multiple things but nothing seems to be working. This is what i have right now

function moveNodeCenter(canvasParent, nodeIndex){
	var canvas = go.Diagram.fromDiv(canvasParent);
	var nodeDataArray = getAllNodes(canvasParent);
	var targetNodeKey = nodeDataArray[nodeIndex].key;
	var targetNodeObj = canvas.findNodeForKey(targetNodeKey);
	let myRobot = new Robot(canvas);
	myRobot.mouseDown(targetNodeObj.x, targetNodeObj.y, 0);
	myRobot.mouseMove(targetNodeObj.x, targetNodeObj.y, 200);
	myRobot.mouseUp(targetNodeObj.x, targetNodeObj.y, 250);
}

not sure if the timestamp is the issue

Note the default hover delay duration:
ToolManager | GoJS API