python - 在python中的react-beautiful-dnd页面上的ActionChain Drag_and_drop
问题描述
有没有人使用 selenium webdriver ActionChain 在 react-beautiful-dnd 页面上执行拖放操作?我可以使用以下方法在一个示例页面上执行拖放操作,但我无法在 react-beautiful-dnd 页面上使用它。它只是显示“您已将一个项目提升到适当的位置,使用箭头键移动,空格键放下,退出键取消。”
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
driver = webdriver.Remote(desired_capabilities=DesiredCapabilities.CHROME, command_executor='http://localhost:4444/wd/hub')
#drag and drop it does not work
driver.get("https://react-beautiful-dnd.netlify.com/iframe.html?selectedKind=board&selectedStory=simple")
loc = '//div[@class="quote-list__DropZone-sc-1fzhh8p-1 fuOOyc"]'
source_loc = driver.find_elements_by_xpath(loc)[1]
target_loc = driver.find_elements_by_xpath(loc)[2]
#error You have lifted an item in position
Use the arrow keys to move, space bar to drop, and escape to cancel.
#work for no problem
driver.get("http://jqueryui.com/resources/demos/droppable/default.html")
source_loc = driver.find_element_by_xpath('//div[@id="draggable"]')
target_loc = driver.find_element_by_xpath('//div[@id="droppable"]')
act = ActionChains(driver).drag_and_drop(source_loc, target_loc)
act.perform()
解决方案
推荐阅读
- python - Python:当列表仅在运行时确定时,如何将可迭代列表传递给 zip?
- node.js - 有没有办法让不和谐机器人回复某人的 dm 禁止发送私人消息?
- php - 如何使用 PHP 从原始 txt 文件中组织数据
- c++ - 仿函数可以总是替换回调吗
- c# - .NETCore 3.1 - 错误 MC1000 未知构建错误,'找不到程序集'System.Web,版本 = 4.0.0.0
- python - python中的x[:,:,::-1]是什么
- amazon-web-services - 为外部客户端连接设置 Cassandra listen_address 时如何避免将弹性 IP 转换为私有 IP?
- microsoft-graph-api - 如何更新 onlineMeeting - Graph API Microsoft 团队会议?
- python - 我的 pip 在 Windows 上坏了,我该如何修复它?
- php - PHP-FPM 进程导致 VPS 上 CPU 使用率高