互联网中有很多滑块的示例,例如
http://jqueryui.com/demos/slider/
是否可以使用Selenium移动滑块?
工作代码
WebDriver driver = new InternetExplorerDriver(); driver.get("http://jqueryui.com/demos/slider/"); //Identify WebElement WebElement slider = driver.findElement(By.xpath("//div[@id='slider']/a")); //Using Action Class Actions move = new Actions(driver); Action action = move.dragAndDropBy(slider, 30, 0).build(); action.perform(); driver.quit();
来源-https: //gist.github.com/2497551