selenium.webdriver.common.actions.action_builder¶
Classes
|
- class selenium.webdriver.common.actions.action_builder.ActionBuilder(driver, mouse: PointerInput | None = None, wheel: WheelInput | None = None, keyboard: KeyInput | None = None, duration: int = 250)[source]¶
- get_device_with(name: str) WheelInput | PointerInput | KeyInput | None [source]¶
Get the device with the given name.
Parameters:¶
- namestr
The name of the device to get.
Returns:¶
Optional[Union[WheelInput, PointerInput, KeyInput]] : The device with the given name.
- property pointer_inputs: List[PointerInput]¶
- property key_action: KeyActions¶
- property pointer_action: PointerActions¶
- property wheel_action: WheelActions¶
- add_key_input(name: str) KeyInput [source]¶
Add a new key input device to the action builder.
Parameters:¶
- namestr
The name of the key input device.
Returns:¶
KeyInput : The newly created key input device.
Example:¶
>>> action_builder = ActionBuilder(driver) >>> action_builder.add_key_input(name="keyboard2")
- add_pointer_input(kind: str, name: str) PointerInput [source]¶
Add a new pointer input device to the action builder.
Parameters:¶
- kindstr
- The kind of pointer input device.
“mouse”
“touch”
“pen”
- namestr
The name of the pointer input device.
Returns:¶
PointerInput : The newly created pointer input device.
Example:¶
>>> action_builder = ActionBuilder(driver) >>> action_builder.add_pointer_input(kind="mouse", name="mouse")
- add_wheel_input(name: str) WheelInput [source]¶
Add a new wheel input device to the action builder.
Parameters:¶
- namestr
The name of the wheel input device.
Returns:¶
WheelInput : The newly created wheel input device.
Example:¶
>>> action_builder = ActionBuilder(driver) >>> action_builder.add_wheel_input(name="wheel2")
- perform() None [source]¶
Performs all stored actions.
Example:¶
>>> action_builder = ActionBuilder(driver) >>> keyboard = action_builder.key_input >>> el = driver.find_element(id: "some_id") >>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys('keys').perform()
- clear_actions() None [source]¶
Clears actions that are already stored on the remote end.
Example:¶
>>> action_builder = ActionBuilder(driver) >>> keyboard = action_builder.key_input >>> el = driver.find_element(By.ID, "some_id") >>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys('keys') >>> action_builder.clear_actions()