• python


    # -*- coding:utf-8 -*-
    
    '''
    @project: web学习
    @author: Jimmy
    @file: 鼠标操作.py
    @ide: PyCharm Community Edition
    @time: 2019-01-22 11:15
    @blog: https://www.cnblogs.com/gotesting/
    
    '''
    
    
    from selenium import webdriver
    from selenium.webdriver.common.action_chains import  ActionChains as AC
    import time
    
    driver = webdriver.Chrome()
    driver.get('http://www.baidu.com')
    
    '''
    # 鼠标操作
    # 由selenium的ActionChains类来完成鼠标操作
    # (1)存储鼠标操作
    # (2)perform()来执行鼠标操作
    #   double_click    双击操作
    #   context_click   右键操作
    #   drag_and_drop   拖拽操作:左键按住拖动某一个元素到另一个区域,然后释放按键
    #   move_to_element 鼠标悬停
    
    from selenium.webdriver.common.action_chains import ActionChains as AC
    # AC.方法名(元素).perform()
    '''
    
    # 设置按钮
    time.sleep(3)
    ele = driver.find_element_by_xpath('//span[@class="setting-text"]')
    
    # 鼠标悬浮在设置上
    
    AC(driver).move_to_element(ele).perform()
    
    
    
    
    
    '''
    # 键盘操作
    from selenium.webdriver.common.keys import Keys
    # send_keys(Keys.CONTROL,'a')   Ctrl+A
    # send_keys(Keys.CONTROL,'c')   Ctrl+C
    # send_keys(Keys.CONTROL,'x')   Ctrl+X
    # send_keys(Keys.CONTROL,'v')   Ctrl+V
    
    # 常用的非组合键
    # 回车键   Keys.ENTER
    # 空格键   Keys.BACK_SPACE
    # 删除键   Keys.SPACE
    # 制表符   Keys.TAB
    # 回退键   Keys.ESCAPE
    # 刷新键   Keys.F5
    '''
  • 相关阅读:
    Spring IoC详解
    Hibernate 和Mybatis的区别
    Nand Flash 驱动框架
    Nor Flash 驱动框架
    USB驱动框架
    输入子系统框架
    module_init 内核调用过程
    平台设备驱动框架
    LCD驱动框架
    嵌入式-开篇
  • 原文地址:https://www.cnblogs.com/gotesting/p/10302906.html
Copyright © 2020-2023  润新知