MouseLocation class is to define the position of mouse action on target element, being used in click, double_click, mouse_up and mouse_down.
Parameters:
Location: Location
The relative position of the target element to perform the mouse action. The available values are ‘center’, ‘left-top’, ‘left-bottom’, ‘right-top’ and ‘right-bottom’, and the default value is ‘center’.
Xoffset: int
sets the x-direction offset relative to Location in pixel. Defautl is 0.
Yoffset: int
sets the y-direction offset relative to Location in pixel. Default is 0.
Xrate: float
sets the x-direction offset relative to Location in percentage of target element width. Default is 0.
Yrate: float
sets the y-direction offset relative to Location in percentage of target element height. Default is 0.
Remarks:
The position calculation can be illustrated as below:
Definition:
class MouseLocation(object):
def __init__(self, location: Literal["center", "left-top", "left-bottom", "right-top","right-bottom"] = Location.Center, xoffset=0, yoffset=0, xrate=0, yrate=0):
self.Location = location
self.Xoffset = xoffset
self.Yoffset = yoffset
self.Xrate = xrate
self.Yrate = yrate