selenium ActionChains「建议收藏」

selenium ActionChains「建议收藏」在元素定位中的层级定位中简单使用了ActionChains 类,下面进行详细介绍class ActionChains(driver)driver:The WebDriver instance which performs user actions.Generate user actions. All actions are stored in the ActionChains 

大家好,欢迎来到IT知识分享网。

在元素定位中的层级定位中简单使用了ActionChains 类,下面进行详细介绍

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.

 

1.– perform()

运行

Performs all stored actions.

2.– click(on_element=None)

左键单击element

Clicks an element.

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

 3.– click_and_hold(on_element)

左键单击element后保持

Holds down the left mouse button on an element.

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

 4.– context_click(on_element)

右键单击element

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

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

 5.– double_click(on_element)

左键双击element

Double-clicks an element.

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

6.– drag_and_drop(source, target)

左键单击source element,保持并移动到target element的位置,释放左键

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.

 7.– 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.

8– 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.

9 – move_by_offset(xoffset, yoffset)

将鼠标移动offset距离

Moving the mouse to an offset from current mouse position.

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

10. – move_to_element(to_element)

将鼠标移动到元素的中间

Moving the mouse to the middle of an element.

to_element: The element to move to.

11.– move_to_element_with_offset(to_element, xoffset, yoffset)

将鼠标移动到当前element的offset距离

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.

12.– release(on_element)

释放鼠标

Releasing a held mouse button.

on_element:The element to mouse up.

13.– send_keys(*keys_to_send)

向当前激活element输入keys

Sends keys to current focused element.

keys_to_send:The keys to send.

 – send_keys_to_element(self, element,*keys_to_send):

向element输入keys

Sends keys to an element.

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

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/24420.html

(0)

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

关注微信