I am trying to get the current coordinates of the cursor in selenium, basically because I want to move it to an element, BUT, very important, I am not looking forward to move it with action chains to the element directly, I want it to do a smooth trajectory, but to make this possible, I need to understand:
- Can I get the current cursor position to calculate trajectory?
or!!
- is there a way to move a "somehow" generated cursor into a trajectory to an element?
NOTE: I don't want this solution
webdriver.ActionChains(self.driver).move_to_element(element).click(
element).perform()
I need something that is more similar to the following:
def element_coordinates(e):
location = e.location
print(location)
return location
e = WebDriverWait(self.driver, 5).until(
EC.element_to_be_clickable((By.XPATH, '//div[contains(@label, "element")]')))
coordinates = element_coordinates(e)
Gives me the following output for a specific element. The following is the kind of output I want to have for the cursor:
>>> {'y': 20, 'x': -65}