How to slide{move} slider in Selenium WebDriver

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

    Using CSS will be good here

    public class testclass 
    
    {
    
      public static void main(String[] args)
    
      {         
    
    
       File file = new File("D:\\Driver\\IEDriverServer.exe");
    
        System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
        WebDriver driver = new InternetExplorerDriver();
        driver.get("http://jqueryui.com/slider/");
    
        WebElement slider = driver.findElement(By.cssSelector("css=div#slider > a"));
        Actions move = new Actions(driver);
        Action action = (Action) move.dragAndDropBy(slider, 30, 0).build();
        ((Actions) action).perform();
    
    }
    
    }
    

提交回复
热议问题