将值设置为滑块输入的正确方法是什么? (量角器自动化)

What is the proper way to set values to a Slider Input? (Protractor Automation)

我在 html 代码中输入了这个滑块:

(很抱歉这是一张图片,我无法访问该页面的代码,我只需要对其进行测试)。

我正在尝试这段代码:

this.maxdivedepth = function (value) {
    var slider = util.getElementAsyncSafe(by.id("maximum-dive-depth"));
    browser.actions().dragAndDrop(
            slider,
            {x: value, y: 0}
    ).mouseUp().perform();
};
例如,

'value' 为“100”。

终端没有显示任何错误,但我没有看到滑块有任何动作..

我尝试了几种方法,例如使用不同的选择器,但还是一样。

谁能帮我解决这个问题?

首先您需要确定滑块上显示的圆形元素的定位器。然后你可以使用下面的代码拖动它,

var slider = $(".rz-pointer-min"); //im not sure about the locator of the circle element.
browser.actions().mouseMove(slider).mouseDown().mouseMove({x:20,y:0 }).mouseUp().perform()