zoukankan      html  css  js  c++  java
  • python学习之鼠标事件&键盘事件

    driver.maximize_window()   浏览器最大化

    ActionChains类与输入事件

    1:from selenium.webdriver.common.action_chains import ActionChains

    2:ActionChains(driver):用于生产模拟用户行为

    3:perform():执行存储行为;

    #鼠标事件:

    #context_click 右击事件

    #double_click双击事件

    #drag_and_drop 拖动

    #click_and_hold按下鼠标左键在一个元素上

    #move_to_element(ele)鼠标停在一个元素上

    ele = driver.find_element_by_link_text('企业直通班')

    ActionChains(driver).move_to_element(ele).perform()

    键盘事件:

    from selenium.webdriver.common.keys import Keys

    send_keys(Keys.BACK_SPACE) 退格键

    send_keys(Keys.CONTRL,'a')全选

    send_keys(Keys.CONTRL,'v')粘贴

    send_keys(Keys.CONTRL,'c')复制

    send_keys(Keys.CONTRL,'x')剪切

    send_keys(keys.ENTER)回车

  • 相关阅读:
    go语言入门(三)
    go语言入门(二)
    Nand Flash 基础
    哈希技术
    NorFlash基础
    二阶构造模式
    C++基础知识汇总
    Arm寄存器介绍及汇编基础
    Linux Makefile详解
    Linux链接器脚本详解
  • 原文地址:https://www.cnblogs.com/lelexiong/p/8982824.html
Copyright © 2011-2022 走看看