4

I need to move my physical mouse pointer. I am using selenium and c#.

Actions action = new Actions(driver);
action.MoveByOffset(500, 500).ContextClick().Build().Perform();
//action.MoveToElement(element).ContextClick().Build().Perform();

Both MoveByOffset and MoveToElement are performing the right-click but the mouse pointer is not moving.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Jessica David
  • 117
  • 3
  • 11

1 Answers1

3

Answering From Java Perspective

No you can't show the mouse pointer moving and performing the task using the Actions Class.

The Java Docs of Actions Class clearly mentions that while Automation through Selenium you should use Actions class only for emulating complex user gestures and but not for using the Keyboard or Mouse directly.

To interact with the the Keyboard or Mouse directly i.e. to generate native system input events for the purposes of Test Automation where control of the mouse and keyboard is needed you should use the Robot Class instead.

You can find a detailed discussion in Why do we need Robot class when we have Actions class in selenium

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352