简体   繁体   中英

Testing JQuery UI Sliders in Cucumber

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM