HTML5 Drag and Drop using Selenium Webdriver for Ruby(使用 Selenium Webdriver for Ruby 进行 HTML5 拖放)
问题描述
是否有任何变通方法可以让 HTML5 拖放与 Selenium Webdriver 和 Ruby 一起使用?我正在使用 Selenium-Webdriver 2.20.0 和 Ruby 1.9.2
Are there any work arounds to getting HTML5 Drag and Drop working with Selenium Webdriver with Ruby? I am using Selenium-Webdriver 2.20.0 with Ruby 1.9.2
这是一个重现问题的简单测试:
Here is a simple test to reproduce the issue:
require "selenium-webdriver"
require "test/unit"
class Html5DragAndDropTest < Test::Unit::TestCase
def setup
@driver = Selenium::WebDriver.for :firefox
@driver.manage.timeouts.implicit_wait = 30
end
def teardown
@driver.quit
end
def test_html5_drag_and_drop
@driver.get("http://html5demos.com/drag")
target = @driver.find_element(:id, "one")
source = @driver.find_element(:id, "bin")
@driver.action.drag_and_drop(target, source).perform
assert target.displayed? == false
end
end
推荐答案
这仍然是 Selenium 中的一个错误,所以上面提到的 JavaScript 解决方法是一个很好的解决方案.
This is still a bug in Selenium, so the JavaScript workaround noted above is a good one.
我构建了 一个示例 HTML 拖放页面,并编写了一个测试来使用 Ryan 提供的 drag_and_drop_helper.js 要点.您可以在这里查看我的完整文章.
I built an example HTML drag and drop page and wrote a test to exercise it using the drag_and_drop_helper.js gist Ryan provided. You can see my full write-up here.
干杯,
戴夫 H
@TourDeDave
这篇关于使用 Selenium Webdriver for Ruby 进行 HTML5 拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 Selenium Webdriver for Ruby 进行 HTML5 拖放


基础教程推荐
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 在for循环中使用setTimeout 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 我什么时候应该在导入时使用方括号 2022-01-01
- 动态更新多个选择框 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 悬停时滑动输入并停留几秒钟 2022-01-01