selenium - Selenium 中可以进行 slider 移动吗?

标签 selenium webdriver selenium-webdriver

这个问题在这里已经有了答案:




9年前关闭。




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



互联网上有很多 slider 的例子,比如

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

是否可以使用 Selenium 移动 slider ?

最佳答案

工作代码-

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

关于selenium - Selenium 中可以进行 slider 移动吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12122824/

相关文章:

java - 如何在 http ://jqueryui. com 中使用 RadioButton 场景的相对 Xpath 定位元素

java - WebDriver异常: disconnected: unable to connect to renderer even on providing correct path of latest chromedriver

python - Selenium python element.screenshot() 不工作

java - 如何在java中使用带有空格的枚举

node.js - 如何告诉 Firefox Quantum 上的 Selenium Webdriver 使用具有身份验证和端口的代理?

javascript - 有没有办法使用 WebDriver 自动触发 setTimeout 事件?

javascript - q 中 'jQuery.active' 的等效行为

ruby - cookies 让我发疯,还是我疯了?

Python Selenium-webdriver : for loop returning first element of the list throughout the loop

python - Robot Framework 找不到元素