Here is an example showing Selenium drags and drops an object.
import time from selenium import webdriver from selenium.webdriver import ActionChains # Create chrome driver. driver = webdriver.Chrome() # Open the webpage. driver.get("https://openwritings.net/sites/default/files/selenium-test-pages/drag-drop.html") # Pause for 5 seconds for you to see the initial state. time.sleep(5) # Drag and drop to target item. ################################## drag_item = driver.find_element_by_id("draggable") target_item = driver.find_element_by_id("droppable") action_chains = ActionChains(driver) action_chains.drag_and_drop(drag_item, target_item).perform() ################################## # Pause for 10 seconds so that you can see the results. time.sleep(10) # Close. driver.close()
Here is a video showing the code above in action.