【发布时间】:2013-08-06 05:59:42
【问题描述】:
尝试使用sendKeys 将用户名和密码传递到表单字段时出现错误。下面是我的用户类,然后是我的测试类。有谁知道为什么应用程序没有传递字符串?
org.openqa.selenium.WebDriverException:未知错误:键应该是字符串
public class User {
public static String username;
public static String password;
public User() {
this.username = "username";
this.password = "password";
}
public String getUsername(){
return username;
}
public String getPassword(){
return password;
}
}
@Test
public void starWebDriver() {
driver.get(domainURL.getURL());
WebElement userInputBox, passInputBox;
userInputBox = driver.findElement(By.xpath("//input[@name='email']"));
passInputBox = driver.findElement(By.xpath("//input[@name='password']"));
System.out.println("before sending keys");
userInputBox.sendKeys(User.username);
}
【问题讨论】:
标签: java selenium webdriver selenium-webdriver