我想记录我们客户网站上提供的滑块验证码。
我们从名为http://www.fmylife.com/signup的其他网站获得了这个概念
这有用于注册的滑块验证码
我尝试使用 selenium webdriver action builder
public class TestFmylife {
WebDriver driver;
Selenium selenium;
@BeforeMethod
public void startSelenium() {
driver = new FirefoxDriver();
selenium = new WebDriverBackedSelenium(driver, "http://www.fmylife.com/");
driver.manage().window().maximize();
}
@AfterMethod
public void stopSelenium() {
driver.close();
}
@Test
public void testFmylife() {
selenium.open("/");
selenium.click("link=Sign up");
selenium.waitForPageToLoad("30000");
selenium.type("name=login", "testfmylife");
selenium.type("name=pass", "123@fmylife");
selenium.type("name=passc", "123@fmylife");
selenium.type("name=mail", "testfmylife@gmail.com");
Point MyPoint= driver.findElement(By.xpath("//*[@id='bgSlider']")).getLocation();
WebElement someElement = driver.findElement(By.xpath("//*[@id='bgSlider']"));
System.out.println(MyPoint.x+"--------"+MyPoint.y);
Actions builder = new Actions(driver);
Action dragAndDrop = builder.clickAndHold(someElement).moveByOffset(MyPoint.x,(MyPoint.y + 100)).release().build();
dragAndDrop.perform();
selenium.click("css=div.form > div.ok > input[type=\"submit\"]");
}
}
但我无法使用此代码移动滑块
帮我解决这个问题