开发者

Testing JQuery UI Sliders in Cucumber

开发者 https://www.devze.com 2023-03-22 19:58 出处:网络
I have a set of 10 JQuery UI sliders that need to be tested in some fashion. Specifically, I need to drag each slider handle and observe the current value of the slider.

I have a set of 10 JQuery UI sliders that need to be tested in some fashion.

Specifically, I need to drag each slider handle and observe the current value of the slider.

I've tried using various methods on the Selenium driver to grab it, like:

handle = find(".ui-slider-handle")
find("#category_weight_#{cw.id}").native.drag_and_drop_by(handle,'10px')

But I keep getting deprecation errors, and can't find decent开发者_开发知识库 examples of using the new action builder in selenium.

Anyone doing this, have any advice?


try this code for sliding:

  page.execute_script "s=$('#slider');"
  page.execute_script "s.slider('option', 'value', #{value})"
  page.execute_script "s.slider('option','slide').call(s,null,{ handle: $('.ui-slider-handle', s), value: #{value} });"


This worked fine for Capybara/Selenium tests.

I tested noui slider for RoR application with Cucumber/Capybara

0

精彩评论

暂无评论...
验证码 换一张
取 消