关闭

selenium-webdriver(python) (十五) -- 鼠标事件

发表于:2013-9-13 11:02

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:虫师    来源:51Testing软件测试网采编

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

相关文章:

selenium-webdriver(python) (十四) -- webdriver原理

33/3<123
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号