如何在量角器中拖放滑块?

时间:2016-05-24 09:39:13

标签: slider protractor

enter image description here

HTML code:

   HardCodedDatabase.testID testObjet = new HardCodedDatabase.testID();
    testObjet.testName = "test1";
   testObjet.manoeuvres.Add(new manoeuvresID(){manName ="man1"});
    List<HardCodedDatabase.testID> listForTesting = new List<HardCodedDatabase.testID>();
    listForTesting.Add(testObjet);

<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>

如何拖动滑块,我尝试使用css选择器,但它无效。

在我的问题中,我只得到X位置定位器值而不是Y位置定位器值,我只有两个类值,即:<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> ngrs-handle ngrs-handle-min使用这两个值如何拖动滑块。

1 个答案:

答案 0 :(得分:0)

最后我找到了答案

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');

    };