硒中的滑块运动可能吗? [英] Slider movement possible in Selenium?

查看:57
本文介绍了硒中的滑块运动可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何移动水平滑块或使用Selenium Webdriver的jQuery垂直滑块

Possible Duplicate:
How to move Horizontal Slider or Vertical Slider of jQuery using Selenium Webdriver

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

There are many examples of slider in internet like

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

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

Is it possible to move the slider using 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

这篇关于硒中的滑块运动可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆