我的代码是:
By slider_humidity = By.XPath("ExampleXpath");
var hSlider = driver.FindElement(slider_humidity);
Actions action = new Actions(driver);
action.MoveToElement(hSlider, 0, 0); //this will make it to start at 0,0 of the slider
action.ClickAndHold(); //don't pass the element, now it will click current mouse location which is (0,0)
action.MoveByOffset(pixelstomove, 0); // move by 30 pixel from 0
action.Build().Perform();
它似乎是太快了,我的目标网站,我需要改变它的速度。它基本上是从0点到给定点瞬间。但我希望它滑动滑块缓慢。也替代方式使用C#中的Javascript将不胜感激,只要我可以调整速度,我的愿望。
1条答案
按热度按时间jdgnovmf1#
试试这个: