I want to simulate a drag within an element using spectron/electron. I tried 2 ways:
await client.moveToObject(selector, fromX, fromY);
await client.buttonDown(0);
await client.moveToObject(selector, toX, toY);
await client.buttonUp(0);
and
await webContents.sendInputEvent({
type: "mouseMove",
x: fromX,
y: fromY
});
await webContents.sendInputEvent({
type: "mouseDown",
button: "left",
x: fromX,
y: fromY
});
await webContents.sendInputEvent({
type: "mouseMove",
button: "left",
x: toX,
y: toY
});
await webContents.sendInputEvent({
type: "mouseUp",
button: "left",
x: toX,
y: toY
});
I also tried plenty different versions/combinations of the above (including e.g. movementX & movementY). I can't use the actions api (my driver does not implement it yet).
With all my approaches, nothing at all happens (no errors neither). Is there a way to implement drag (not drag&drop, it's just within one element)?