How to slide{move} slider in Selenium WebDriver

后端 未结 11 2035
花落未央
花落未央 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:09

    I think the slide is use css style format to scroll so we change element's style

    JavascriptExecutor js = (JavascriptExecutor) driver;
    
    WebElement a = driver.findElement(By.xpath("//div[@id='slider-1']/a"));
    
    js.executeScript("arguments[0].setAttribute('style', 'left: 30%;')",a);
    

提交回复
热议问题