小编典典

selenium中滑块可能移动吗?

selenium

互联网中有很多滑块的示例,例如

http://jqueryui.com/demos/slider/

是否可以使用Selenium移动滑块?


阅读 423

收藏
2020-06-26

共1个答案

小编典典

工作代码

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

2020-06-26