zoukankan      html  css  js  c++  java
  • selenium的鼠标mouse操作

      selenium的鼠标mouse操作:

    from selenium import webdriver
    from selenium.webdriver.common.action_chains import ActionChains
    import time
    
    
    driver=webdriver.Chrome()  #配置参数
    driver.get("https://www.baidu.com")
    above=driver.find_element_by_link_text(u"设置")
    ActionChains(driver).move_to_element(above).perform()  #鼠标停留
    #ActionChains(driver).move_to_element(above).move_to_element(elem) 移动   elem需要自己放元素
    ActionChains(driver).move_to_element(above).context_click()  #鼠标单击
    ActionChains(driver).move_to_element(above).double_click()  #鼠标双击
    ActionChains(driver).move_to_element(above).drag_and_drop()  #拖放 先挪到这个位置上抓住,再抓到一个元素,再把它放了
    
    
    
    time.sleep(10)
  • 相关阅读:
    测试开发技术
    测试开发技术难题与解决
    .gitignore文件
    mysql 子查询 联结 组合查询
    DTL
    jquery 基础
    Django操作数据库
    git 进阶篇
    miniconda使用
    pycharm之django基本配置
  • 原文地址:https://www.cnblogs.com/my-global/p/12467526.html
Copyright © 2011-2022 走看看