'Moving mouse pointer(cursor) to a specific location or element using C# and Selenium

I performing a click operation using Selenium and C#.

I can able to perform click operation but i can't able to move mouse pointer(cursor) to a specific co-ordinate or over specific element.

Actions action = new Actions(driver);
action.MoveByOffset(500, 500).ContextClick().Perform();

This is the code I am using. The context click is working but the cursor not moving.

Help me with this.



Solution 1:[1]

Rather than trying to get an element just move by offset. Make sure you know what your prior focus is... If none then it should be the top left corner of the page. Then put your sleep in the middle and you should be able to see the mouse move, wait, and then click.

Actions action = new Actions(driver);
action.MoveByOffset(200,100).Perform();
Thread.Sleep(10000);
action.Click();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dhru 'soni