【发布时间】:2019-09-16 12:58:27
【问题描述】:
我在 selenium 中创建了一个测试并将其导出到 python 中。该测试包括将元素拖放到 div。当我在 python 中运行测试时,无法执行拖放操作。我使用的代码是:
source_element = self.driver.find_elements_by_xpath("//*[contains(@id,
'plinkTest')]")
dest_element = self.driver.find_elements_by_xpath("//*
[@id='tools_dep_jstree_id']")
actions = ActionChains(self.driver)
actions.move_to_element(source_element).click_and_hold().perform()
actions = ActionChains(self.driver)
actions.move_to_element(dest_element).perform()
actions = ActionChains(self.driver)
actions.move_to_element(dest_element).release().perform()
我得到的错误是“move_to 需要一个 web 元素”。
【问题讨论】:
-
请提供相关的HTML?
标签: python selenium drag-and-drop