0

enter image description here

HTML code :

<div class="ngrs-range-slider ng-isolate-scope" range-slider="" min="0" max="30" attach-handle-values=
"true" model-min="experience.minVal" model-max="experience.maxVal" style="margin: 28px 0px 0px 0px;">

`<div class="ngrs-runner"><div class`="ngrs-handle ngrs-handle-min" style="left: 0%;"><i></i></div>

<div class="ngrs-handle ngrs-handle-max" style="left: 10%;"><i></i></div>

<div class="ngrs-value-runner ngrs-attached-handles"><div class="ngrs-value ngrs-value-min ng-hide" ng-show="showValues" style="left: 3.33333%;"><div class="ng-binding">1</div></div>

<div class="ngrs-value ngrs-value-max ng-hide" ng-show="showValues" style="left: 10%; right: auto;"><div class="ng-binding">3</div></div></div></div>

How to drag a slider, I tried with css selectors but it is not working.

In my problem, am only getting X position locator value not Y position locator value and I have only two class values i.e : ngrs-handle ngrs-handle-min and 'ngrs-handle ngrs-handle-max' Using these two values how to drag slider.

halfer
  • 19,824
  • 17
  • 99
  • 186
nrs
  • 937
  • 3
  • 17
  • 42
  • See the [answers to this question](http://stackoverflow.com/questions/24315571/drag-drop-with-protractor-by-repeater?rq=1) and/or [this question](http://stackoverflow.com/questions/25664551/how-to-simulate-a-drag-and-drop-action-in-protractor?rq=1) – Gunderson May 24 '16 at 10:20
  • @Gunderson I tried both answer and still am not able to drag slider. Can you please help me out of this. I am getting this error : Failed: No element found using locator: By(css selector, .ngrs-handle.ngrs-handle-max.ngrs-over.ngrs-down). Why am getting this error is because of locator only visible after moving the slider to target position so it is showing error. please help me. – nrs May 25 '16 at 05:35

1 Answers1

0

Finally i found an answer

this.test_slider = function(){
        var sliderBar = ptor.findElement(protractor.By.css(".ngrs-handle.ngrs-handle-max"));
        browser.actions().dragAndDrop(sliderBar,{x:50,y:0}).perform(); 
        ptor.sleep(10000);
        expect(sliderBar.getAttribute('value')).toEqual('7');

    };
nrs
  • 937
  • 3
  • 17
  • 42