鼠标键盘操作 Mouse and keyboard operation
| 1 | |
| 2 | |
| 3 | class KeymouseOperation: |
| 4 | """ |
| 5 | 鼠标键盘操作 |
| 6 | Mouse and keyboard operation |
| 7 | """ |
| 8 | |
| 9 | def click_mouse_by_element(self, xpath: str, typ: int) -> bool: |
| 10 | """ |
| 11 | 根据元素位置点击鼠标(元素中心点) |
| 12 | |
| 13 | xpath: 元素 xpath 路径 |
| 14 | typ: 点击类型,单击左键:1 单击右键:2 按下左键:3 弹起左键:4 按下右键:5 弹起右键:6 双击左键:7 |
| 15 | return: 布尔值 |
| 16 | |
| 17 | xpath: Element xpath path |
| 18 | typ: Click type, click left key: 1 Right click: 2 Press left key: 3 Pop up left key: 4 Press right key: 5 Pop up right key: 6 Double click left key: 7 |
| 19 | return: bool |
| 20 | """ |
| 21 | return "true" in self.SendData("clickMouseByXpath", xpath, typ) |
| 22 | |
| 23 | def move_to_element(self, xpath: str) -> bool: |
| 24 | """ |
| 25 | 移动鼠标到元素位置(元素中心点) |
| 26 | Move the mouse to the element position (element center point) |
| 27 | |
| 28 | xpath: 元素 xpath 路径 |
| 29 | return: 布尔值 |
| 30 | |
| 31 | xpath: Element xpath path |
| 32 | return: bool |
| 33 | """ |
| 34 | return "true" in self.SendData("moveMouseByXpath", xpath) |
| 35 | |
| 36 | def scroll_mouse_by_element(self, xpath: str, offset_x: float, offset_y: float) -> bool: |
| 37 | """ |
| 38 | 根据元素位置滚动鼠标 |
| 39 | Scroll the mouse according to the element position. |
| 40 | |
| 41 | xpath: 元素路径 |
| 42 | offset_x: 水平滚动条移动的距离 |
| 43 | offset_y: 垂直滚动条移动的距离 |
| 44 | return: 布尔值 |
| 45 | |
| 46 | xpath: xpath path |
| 47 | offset_x: The distance the horizontal scroll bar moves |
| 48 | offset_y: Distance the vertical scroll bar moves. |
| 49 | return: bool |
| 50 | """ |
| 51 | return "true" in self.SendData("wheelMouseByXpath", xpath, offset_x, offset_y) |
| 52 | |
| 53 | def click_mouse(self, point: tuple, typ: int) -> bool: |
| 54 | """ |
| 55 | 点击鼠标 |
| 56 | click the mouse |
| 57 | |
| 58 | point: 坐标点 |
| 59 | typ: 点击类型,单击左键:1 单击右键:2 按下左键:3 弹起左键:4 按下右键:5 弹起右键:6 双击左键:7 |
| 60 | return: 布尔值 |
nothing calls this directly
no outgoing calls
no test coverage detected