-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbasics_selenium14.py
More file actions
26 lines (21 loc) · 865 Bytes
/
basics_selenium14.py
File metadata and controls
26 lines (21 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'''
Let us perform some more functionality around ActionChain
Drag and Drop --> we can simple drag and drop the elements using
action.drag_and_drop(element_source, element_target).perform()
'''
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
import time
driver=webdriver.Chrome(executable_path="chromedriver.exe")
driver.get("https://testautomationpractice.blogspot.com/")
element = driver.find_element(By.CSS_SELECTOR,"button[ondblclick='myFunction1()']")
time.sleep(2)
action =ActionChains(driver)
drag = driver.find_element(By.ID,"draggable")
to_drop = driver.find_element(By.ID,"droppable")
action.drag_and_drop(drag,to_drop).perform()
time.sleep(2)
driver.maximize_window()
driver.save_screenshot("dragAnddrop.png")
driver.quit()