selenium+python键盘加鼠标操作
2017-04-13 11:05
796 查看
from selenium.webdriver.common.action_chains import ActionChains
action = ActionChains(driver)action.key_down(Keys.SHIFT).perform() #按下shift键drinvr.find_element_by_xpath('xpath_path').click() #点击鼠标左键action.key_up(Keys.SHIFT).perform() #松开shift键#以上代码为shift+鼠标左键多选操作action.key_down(keys.CONTROL).send_keys('a').key_up(keys.CONTROL).PERFORM() #ctrl+a键盘操作#以下是键盘鼠标操作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) ——发送某个键到指定元素
相关文章推荐
- python + selenium webdriver 通过python来模拟鼠标、键盘操作,来解决SWFFileUpload调用系统底层弹出框无法定位问题
- Python Selenium 键盘和鼠标操作
- 玩转python selenium鼠标键盘操作(ActionChains)
- python selenium鼠标键盘操作(ActionChains)
- Python Selenium 学习笔记(三)键盘和鼠标操作
- Python-Selenium2做Web自动化测试(5)-对象事件的操作(鼠标操作、键盘操作)
- python selenium2 - 鼠标键盘操作
- 玩转python selenium鼠标键盘操作(ActionChains)
- Python Selenium 学习笔记(三)键盘和鼠标操作
- python selenium常用基本方法---H5和键盘鼠标操作
- 用Python+Selenium模拟键盘和鼠标操作,实现自动签到
- Selenium键盘鼠标操作总结
- selenium webdriver学习(十三)------------如何利用Actions类模拟鼠标和键盘的操作
- selenium webdriver学习(十三)------------如何利用Actions类模拟鼠标和键盘的操作
- selenium webdriver模拟鼠标键盘操作
- selenium 使用action进行鼠标,键盘操作
- selenium之 玩转鼠标键盘操作(ActionChains)
- python selenium-webdriver 元素操作之键盘操作(五)
- selenium之 玩转鼠标键盘操作(ActionChains)
- python模拟鼠标和键盘操作