I'm using the python package to move the mouse in some specified pattern or just random motions. 
The first thing I tried is to get the size of the //html element and use that to make the boundaries for mouse movement. However, when I do this the MoveTargetOutOfBoundsException rears its head and displays some "given" coordinates (which were not anywhere near the input.
The code I used:

origin = driver.find_element_by_xpath('//html')
bounds = origin.size
print bounds
ActionChains(driver).move_to_element(origin).move_by_offset(bounds['width'] - 10, bounds['height'] - 10).perform()

So I subtract 10 from each boundary to test it and move to that position (apparently the move_to_element_by_offset method is dodgy). 
MoveTargetOutOfBoundsException: Message: Given coordinates (1919, 2766) are outside the document. Error: MoveTargetOutOfBoundsError: The target scroll location (17, 1798) is not on the page.
Stacktrace:
    at FirefoxDriver.prototype.mouseMoveTo (file://...
The actual given coordinates were (1903-10=1893, 969-10=989).
Any ideas?
Two possible problems:
1) There could be scroll on the page, so before clicking you should have scroll into element view
2) Size is given without browser elements respect, and in real world you should substitute about 20 or 30 to have original size (you could test test that values)
Selenium moving to absolute positions