unibrementypo3auto/content/action_chain_drag_and_drop.py
2023-05-17 17:43:35 +02:00

17 lines
456 B
Python

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
def action_chain_drag_and_drop(
driver: webdriver.firefox.webdriver.WebDriver,
x_from: int,
y_from: int,
x_to: int,
y_to: int,
):
actions = ActionChains(driver)
actions.move_by_offset(x_from, y_from)
actions.click_and_hold()
actions.move_by_offset(x_to - x_from, y_to - y_from)
actions.release()
actions.perform()