Monday, 20 March 2017

Fancytree Drag and drop of Node

I want to move a node from right tree to left tree. At begin, I try to implement this action by drag_and_drop function. But failed.


Solution : I use click_and_hold, move_to_element, click and release methods to completed this action.

python:
     righttree = driver.find_element_by_xpath(".//*[@id='right']/ul/li[1]/span/span[3]")

     target = driver.find_element_by_xpath(".//*[@id='left']/ul/li[1]/span")

     actions = ActionChains(driver)
     actions.click_and_hold(righttree)
     actions.move_to_element(target)
     actions.click(target)
     actions.release()
     actions.perform()
     WebDriverWait(driver, 10).until(
       (EC.element_to_be_clickable((By.XPATH, ".//*[@id='left']/ul/li[1]/ul/li/span/span[3]"))))
time.sleep(2)









No comments:

Post a Comment

how-to-recursively-create-subfolder-in-each-folder-of-a-directory-in-cmd

test.cmd: @echo off setlocal for /f "usebackq tokens=*" %%a in (`dir /b /a:d`) do ( rem enter the directory pushd %%a echo...