How to slide{move} slider in Selenium WebDriver

后端 未结 11 2042
花落未央
花落未央 2021-02-11 09:30

How to slide slider on horizontal progress bar URL: http://jqueryui.com/slider/ I tried to scroll the slider but it did not work for me. My code using Java is below:

         


        
11条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-11 10:20

    Use this code

    Actions dragger = new Actions(driver);
    WebElement draggablePartOfScrollbar = driver.findElement(By.xpath("**xpath of slider**"));
    int numberOfPixelsToDragTheScrollbarDown = 5000;
    dragger.moveToElement(draggablePartOfScrollbar).clickAndHold().moveByOffset(0,numberOfPixelsToDragTheScrollbarDown).release().perform();
    

提交回复
热议问题