zoukankan      html  css  js  c++  java
  • selenium鼠标事件

    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) ——发送某个键到指定元素

    class ActionChains(driver)

    driver:The WebDriver instance which performs user actions.

    Generate user actions. All actions are stored in the ActionChains object. Call perform() to fire stored actions.

     

      – perform()

    Performs all stored actions.

     

      – click(on_element=None)

    Clicks an element.

    on_element:The element to click. If None, clicks on current mouse position.

     

      – click_and_hold(on_element)

    Holds down the left mouse button on an element.

    on_element:The element to mouse down. If None, clicks on current mouse position.

     

      – context_click(on_element)

    Performs a context-click (right click) on an element.

    on_element:The element to context-click. If None, clicks on current mouse position.

     

      – double_click(on_element)

    Double-clicks an element.

    on_element:The element to double-click. If None, clicks on current mouse position.

      

      – drag_and_drop(source, target)

    Holds down the left mouse button on the source element, then moves to the target element and releases the mouse button.

    source:The element to mouse down.

    target: The element to mouse up.

     

      – key_down(key, element=None)

    Sends a key press only, without releasing it. Should only be used with modifier keys (Control, Alt andShift).

    key:The modifier key to send. Values are defined in Keys class.

    element:The element to send keys. If None, sends a key to current focused element.

      – key_up(key, element=None)

    Releases a modifier key.

    key:The modifier key to send. Values are defined in Keys class.

    element:The element to send keys. If None, sends a key to current focused element.

     

      – move_by_offset(xoffset, yoffset)

    Moving the mouse to an offset from current mouse position.

    xoffset:X offset to move to.yoffset:Y offset to move to.

     

      – move_to_element(to_element)

    Moving the mouse to the middle of an element.

    to_element: The element to move to.

     

      – move_to_element_with_offset(to_element, xoffset, yoffset)

    Move the mouse by an offset of the specificed element. Offsets are relative to the top-left corner of the

    element.

    to_element: The element to move to.xoffset:X offset to move to.yoffset:Y offset to move to.

     

      – release(on_element)

    Releasing a held mouse button.

    on_element:The element to mouse up.

     

      – send_keys(*keys_to_send)

    Sends keys to current focused element.

    keys_to_send:The keys to send.

     

      – send_keys_to_element(self, element,*keys_to_send):

    Sends keys to an element.

    element:The element to send keys.keys_to_send:The keys to send.

  • 相关阅读:
    PUTTY与SecureCRT的比较
    java中volatile关键字的含义
    java中引用的原理
    Java陷阱之assert关键字
    脏读 幻读 不可重复读
    JAVA 的wait(), notify()与synchronized同步机制
    线程状态转换图
    并行、并发、同步和互斥
    B-树学习笔记
    平衡二叉树及其应用场景
  • 原文地址:https://www.cnblogs.com/a389678070/p/9635296.html
Copyright © 2011-2022 走看看