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?
The problem in my case was that I was not waiting for the element to load. At least I assume that's what the problem is because if I allow selenium to wait for the element instead and then click on it, it works.
Selenium moving to absolute positions