Drag and Drop operation

Drag_and_Drop.py

from selenium import webdriver
from selenium.common.exceptions import ElementNotVisibleException, NoSuchElementException
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
import time

driver = webdriver.Chrome("/Users/admin/Documents/Skill2Lead/Others/drivers/chromedriver.exe")

driver.get("http://www.dummypoint.com/DragAndDrop.html")
assert "Selenium Template" in driver.title
time.sleep(2)

wait = WebDriverWait(driver, 25, poll_frequency=1,
                     ignored_exceptions=[ElementNotVisibleException, NoSuchElementException])

ele_drag = wait.until(ec.presence_of_element_located((By.ID,"drag")))
ele_drop = wait.until(ec.presence_of_element_located((By.ID,"drop")))

time.sleep(2)

# 1. Create the object for ActionChains class
actions = ActionChains(driver)

actions.click_and_hold(ele_drag).move_to_element(ele_drop).release(ele_drop).perform()
time.sleep(5)


driver.quit()