@Override
public WebElement apply(WebDriver dr) {
return dr.findElement(By.id("TPL_username_1"));
}}).clear();
System.out.println("pageSource>>"+driver.getPageSource());
// driver.findElement(By.id("TPL_username_1")).clear();
driver.findElement(By.id("TPL_username_1")).sendKeys("honger08240129");
driver.findElement(By.id("TPL_password_1")).clear();
driver.findElement(By.id("TPL_password_1")).sendKeys("a123456");
driver.findElement(By.id("J_SubmitStatic")).click();
return new TaoBaoLogin(driver);
}
TaoBaoLogin 类如下:
public class TaoBaoLogin {
private WebDriver driver;
public TaoBaoLogin(WebDriver driver){
this.driver=driver;
}
public String getTitle(){
return driver.getTitle();
}
public String getContent(){
return driver.getPageSource();
}
}
AuthorizeLogin 类如下:
public class AuthorizeLogin {
private WebDriver driver;
public AuthorizeLogin(WebDriver driver){
this.driver=driver;
}
public String getTitle(){
return driver.getTitle();
}
public String getContext(){
return driver.getPageSource();
}
}
目前能跳转到淘宝登陆页 但是在运行到openLoginPage(WebDriver driver)这个方法提示:org.openqa.selenium.WebDriverException: Unable to get browser (WARNING: The server did not provide any stacktrace information)作者: yazi0127 时间: 2012-12-27 09:30
在“openLoginPage”使用selectWindow方法试试。