ActionChains simulate mouse operation collection (available when using Selenium in Python to automate testing)

ActionChains can perform operations that need to simulate mouse operations, such as clicking, double-clicking, clicking the right mouse button, dragging, and so on.

ActionChains method list:

click(on_element=None)-click the left mouse button

click_and_hold(on_element=None) ——click the left button of the mouse without releasing it

context_click(on_element=None)-click the right mouse button

double_click(on_element=None) ——Double click the left mouse button

drag_and_drop(source, target)-drag to an element and then release

drag_and_drop_by_offset(source, xoffset, yoffset)-drag to a certain coordinate and then release

key_down(value, element=None)-press a key on a keyboard

key_up(value, element=None)-release a key

move_by_offset(xoffset, yoffset)-the mouse moves from the current position to a certain coordinate

move_to_element(to_element)-the mouse moves to an element

move_to_element_with_offset(to_element, xoffset, yoffset) —— move to the position of how far away from an element (upper left coordinate)

perform()-perform all actions in the chain

release(on_element=None)-release the left mouse button at an element position

send_keys(*keys_to_send) ——Send a key to the currently focused element

send_keys_to_element(element, *keys_to_send)-send a key to the specified element

Guess you like

Origin blog.csdn.net/weixin_47761086/article/details/110819093