我正在使用Soda来运行Selenium Webdriver。在大多数情况下,它都像预期的那样工作,但我正在尝试弄清楚如何向浏览器发送向右和向左的光标键来移动jquery ui滑块手柄。
我试过了
.typeKeys('css=a.ui-slider-handle[lr="l"]','\37')和
.type('css=a.ui-slider-handle[lr="l"]','\37')和
.typeKeys('\37')和
.type('\37')似乎没有任何东西可以移动滑块。它们也都没有错误。在我这么做之前,我会点击一下手柄,以确保...
有人知道怎么做吗?
发布于 2013-03-20 14:23:20
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();发布于 2013-04-09 12:09:23
在下面,我用jquery UI滑块页面在firefox中测试了一下,它对我很有效。
.clickAt(“//div@id=‘滑块’/a1”,"")
//鼠标左键按下
.mouseDownAt(“//div@id=‘滑块’/a1”,"0,0")
//将光标向左移动约200
.mouseMoveAt(“//div@id=‘滑块’”,"200,0")
//松开鼠标键
.mouseUpAt("//div@id='slider'","");
https://stackoverflow.com/questions/15505344
复制相似问题