水豚'拖&下降不起作用
我在 Mac 上使用 Cucumber/capybara/selenium/firefox。除了 d&d 之外,一切都运行良好。可通过 drag_node.drag_to(drop_node)
进行拖放。调用时,它不会引发任何错误,但实际的拖放从未发生。
现在,我不再是复制粘贴零碎内容,而是找到了这个示例应用程序(由一个人编写)谁显然有类似的问题)证明了这个问题。
然而,Google 并不知道 drag_to()
已被破坏。据我所知。这给人一种希望,那就是我错过了一些东西,而不是一个错误。那么它是什么?我缺少什么?一个错误?
I am using cucumber/capybara/selenium/firefox on Mac. All working great except for d&d. Drag and drop is available via drag_node.drag_to(drop_node)
. When called, it does not raise any errors but the actual drag and drop just never happens.
Now rather than copy pasting bits and pieces, I've found this sample app (written by a guy who apparently had similar problems) that demonstrates the issue.
Google however isn't aware of drag_to()
being broken. As far as I could see. That gives a hope that it is me missing something rather than a bug. So what is it? What am I missing? A bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
对我来说,
#drag_to
确实有效,但是,它的功能似乎有限。为了将 UI 可排序表行向下移动,我必须创建一个包含三行的表,然后运行此代码(在 Cucumber 步骤中):
这会将第一行与第二行交换。我的解释是水豚拖得不够远,所以我给了它一个超出我实际目标的目标。
注意:我已使用
tolerance: 'pointer
' 配置了 UI-sortable。For me,
#drag_to
did work, however, its powers seem to be limited.In order to move a UI-sortable table row down, I had to create a table with three rows, then run this code (in a Cucumber step):
This would swap the first with the second row. My interpretation is that Capybara does not drag far enough, so I gave it a target beyond my actual target.
Note: I have configured UI-sortable with
tolerance: 'pointer
'.我遇到了同样的问题,并通过直接进入 selenium-webdriver 解决了它。
我使用 selenium-webdriver 2.20.0 和 Capybara 1.1.2,
这适用于这个 HTML
现在在 Ruby 代码之前。
从水豚调用 page.driver.browser 获取 selenium-webdriver
I have had the same proble and solved it by going directly to the selenium-webdriver.
I an using selenium-webdriver 2.20.0 and Capybara 1.1.2
this works with this HTML
Now fore the Ruby code.
Getting at the selenium-webdriver from capybara call page.driver.browser
这是 selenium-webdriver 在可排序列表方面存在问题。这篇文章介绍了解决方法:http://www.dixis.com/?p=626
It is selenium-webdriver having problem with sortable lists. This post covers the workaround: http://www.dixis.com/?p=626
#drag_to
不适用于可排序列表,大概是因为您没有像拖动设定的距离和方向那样拖动“到”元素。 Selenium 的#drag_by
是您正在寻找的,但 Capybara 目前不支持。另请参阅:
https://github.com/jnicklas/capybara/issues/222
< a href="https://github.com/jnicklas/capybara/issues/119" rel="nofollow">https://github.com/jnicklas/capybara/issues/119
#drag_to
does not work on sortable lists, presumably since you aren't dragging "to" an element as much as dragging a set distance and direction. Selenium's#drag_by
is what you're looking for but is not currently supported by Capybara.See also:
https://github.com/jnicklas/capybara/issues/222
https://github.com/jnicklas/capybara/issues/119
这对我有用:
背景:
警告:我通过反复试验发现了这一点,实际上我不确定它为什么有效。 YMMV 并自行承担使用风险。
This has worked for me:
Background:
WARNING: I discovered this by trial-and-error, and I'm actually not sure why it works. YMMV and use at your own risk.