0

I've moved to a specific object position using ActionChians move_to_element function. Later on I use the move_by_offset function to move to a specific point of the page but the mouse position is set to the position of the element used in the move_to_element function. Now, the point in which I want to move to is fixed and everytime I need to move the mouse position to the (0, 0) point of the page using the move_by_offset function with (-position_X_of_last_element, -position_Y_of_last_element) and then move to the point in which I want to move. Since it is very annoying to track everytime the position of the element used in the move_to_element function, I was curious if it exists a method to retrieve the mouse position on the page

Alexey R.
  • 8,057
  • 2
  • 11
  • 27
marco
  • 525
  • 4
  • 11
  • Try to check how you can get coordinates using javascript and than you can execute that javascript using `JavascriptExecutor` in selenium. You will be able to find related topics on stackoverlow itself. – Sariq Shaikh Nov 23 '20 at 16:45

1 Answers1

0

See this question and answer for a Python solution: How to print out 'Live' mouse position coordinates using pyautogui?

Also view the linked YouTube video from about 13 minutes in.

CJC
  • 400
  • 4
  • 15
  • Is this not possible with Selenium? – marco Nov 23 '20 at 14:30
  • not sure - I have not personally used Selenium and it can be driven from different code languages, I have used pyautogui in python to create a mouse location reader as demonstrated in the linked answer and video – CJC Nov 23 '20 at 16:57