【发布时间】:2017-08-21 05:52:50
【问题描述】:
我需要在网页的用户名字段中获取文本,而不是在控制台中获取用户输入,我的代码:
public void loginpage(){
driver.findElement(By.id("Username")).clear();
System.out.println("Username: ");
Scanner scan1 = new Scanner(System.in);
String input1 = scan1.nextLine();
System.out.println(input1);
driver.findElement(By.id("password")).clear();
System.out.println("password: ");
Scanner scan2 = new Scanner(System.in);
String input2 = scan2.nextLine();
Select drp= new Select(driver.findElement(By.name("AdminTypeId")));
drp.selectByVisibleText("Super Admin");
driver.findElement(By.id("login-submit")).click();
}
【问题讨论】:
-
您能告诉我们您尝试自动化的确切手动步骤吗?
标签: java selenium selenium-webdriver automated-tests