Selenium 如何使用苏打/硒发送左右光标?
我正在使用Selenium 如何使用苏打/硒发送左右光标?,selenium,selenium-webdriver,soda,Selenium,Selenium Webdriver,Soda,我正在使用Soda运行Selenium Webdriver。大多数情况下,它都能按预期工作,但我正在尝试找出如何将左右光标键发送到浏览器以移动jquery ui滑块句柄 我试过了 .typeKeys('css=a.ui-slider-handle[lr="l"]','\37') 及 及 及 似乎没有任何东西移动滑块。他们也都没有错。在我做这件事之前,我会先点击一下手柄,以确保 有人知道怎么做吗?用Java编写代码- WebDriver driver = new InternetExplorer
Soda
运行Selenium Webdriver
。大多数情况下,它都能按预期工作,但我正在尝试找出如何将左右光标键发送到浏览器以移动jquery ui滑块句柄
我试过了
.typeKeys('css=a.ui-slider-handle[lr="l"]','\37')
及
及
及
似乎没有任何东西移动滑块。他们也都没有错。在我做这件事之前,我会先点击一下手柄,以确保
有人知道怎么做吗?用Java编写代码-
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();
Source-试试下面,我在firefox中用jQueryUI滑动页面测试了这一点,它对我很有效 .clickAt(“//div[@id='slider']/a[1]”,“”) //鼠标左键按下 .mouseDownAt(//div[@id='slider']/a[1],“0,0”) //将光标向左移动约200 .mouseMoveAt(//div[@id='slider'],“200,0”) //松开鼠标按钮
.mouseUpAt(“//div[@id='slider']”,“”) 谢谢。我在dragAndDrop操作中遇到了一些问题,但我猜这与我正在使用的访问器有关。可能是时间问题,因为jquery在尝试这样做之前还没有完成它的工作……将继续调查。不管怎样,你的回答很有帮助。
.typeKeys('\37')
.type('\37')
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();