您现在的位置是:首页 > Python 当前栏目 python selenium-ActionChains方法 2023-03-02 11:23:47 时间 # **1.ActionChains方法列表** # click(on\_element=None) ——单击鼠标左键 click\_and\_hold(on\_element=None) ——点击鼠标左键,不松开 context\_click(on\_element=None) ——点击鼠标右键 double\_click(on\_element=None) ——双击鼠标左键 drag\_and\_drop(source, target) ——拖拽到某个元素然后松开 drag\_and\_drop\_by\_offset(source, xoffset, yoffset) ——拖拽到某个坐标然后松开 key\_down(value, element=None) ——按下某个键盘上的键 key\_up(value, element=None) ——松开某个键 move\_by\_offset(xoffset, yoffset) ——鼠标从当前位置移动到某个坐标 move\_to\_element(to\_element) ——鼠标移动到某个元素 move\_to\_element\_with\_offset(to\_element, xoffset, yoffset) ——移动到距某个元素(左上角坐标)多少距离的位置 perform() ——执行链中的所有动作 release(on\_element=None) ——在某个元素位置松开鼠标左键 send\_keys(\*keys\_to\_send) ——发送某个键到当前焦点的元素 send\_keys\_to\_element(element, \*keys\_to\_send) ——发送某个键到指定元素 # 2.例子 # action = ActionChains(browser)\#实例化一个对象 action.move\_to\_element(element).perform()\#鼠标移动到element action.click(element).perform()\#点击element 本文地址: python selenium-ActionChains方法 相关文章 python高级函数 选择排序(Python) Python list 实现 python百分数小数 Python字符串乘法 Docker 安装 Python python实现栈 python第二课 Python学习指南 Python 虚拟机 Python基础笔记 Python学习(1) Day-6 python python基础04 python学习(1) Day-7 python python Tesseract-OCR Python PyInstaller命令 Python 拷贝对象 python生成uuid