python-scraping icon indicating copy to clipboard operation
python-scraping copied to clipboard

chapter13/4-dragAndDrop.py Doesn't work

Open mengyyy opened this issue 8 years ago • 2 comments

debian 7

from selenium import webdriver from selenium.webdriver.remote.webelement import WebElement from selenium.webdriver import ActionChains

driver = webdriver.PhantomJS(executable_path='./phantomjs') driver.get('http://pythonscraping.com/pages/javascript/draggableDemo.html')

print(driver.find_element_by_id("message").text) Prove you are not a bot, by dragging the square from the blue area to the red area!

element = driver.find_element_by_id("draggable") target = driver.find_element_by_id("div2") actions = ActionChains(driver) actions.drag_and_drop(element, target).perform()

print(driver.find_element_by_id("message").text) Prove you are not a bot, by dragging the square from the blue area to the red area!

====== the same result saw at windows7 too!! and i found this https://github.com/SeleniumHQ/selenium/issues/2533

mengyyy avatar Nov 20 '16 11:11 mengyyy

I came across the same question on a MAC. There is a solution in javascript http://elementalselenium.com/tips/39-drag-and-drop But I don't know how to solve it in Python 3

8cold8hot avatar Dec 19 '16 10:12 8cold8hot

Other example work http://www.mahsumakbas.net/drag-and-drop-operation-in-selenium/

ohotnikoff avatar Jan 20 '17 03:01 ohotnikoff