我是一个尝试学习Eclipse的新手,遇到了一个我无法解决的问题 找到答案。我正在尝试使用Datadriven框架来捕获错误消息 在网站上,并在控制台上显示,但webdriver没有显示 消息。我尝试使用IE 11和Firefox并遇到同样的问题。这是代码 我正在使用:
for (int k=1;k<myRows;k++){
MyFirstName=myXLSheet[k][0];
MyLastName=myXLSheet [k][1];
MyEmailID=myXLSheet [k][2];
MyReenterEmail=myXLSheet [k][2];
MyPassword=myXLSheet [k][3];
MyMonth=myXLSheet [k][4];
MyDay=myXLSheet [k][5];
MyYear=myXLSheet [k][6];
mydriver.navigate().to(myURL);
mydriver.findElement(By.xpath(".//*[@id='u_0_1']")).sendKeys(MyFirstName);
mydriver.findElement(By.xpath(".//*[@id='u_0_3']")).sendKeys(MyLastName);
mydriver.findElement(By.xpath(".//*[@id='u_0_5']")).sendKeys(MyEmailID);
mydriver.findElement(By.xpath(".//*[@id='u_0_8']")).sendKeys(MyReenterEmail);
mydriver.findElement(By.xpath(".//*[@id='u_0_a']")).sendKeys(MyPassword);
//Select Month from Dropdown
Select month=new Select (mydriver.findElement(By.xpath(".//*[@id='month']")));
month.selectByVisibleText(MyMonth);
//Select Day Dropdown
Select day=new Select (mydriver.findElement(By.xpath(".//*[@id='day']")));
day.selectByVisibleText(MyDay);
//Select Year Dropdown
Select year=new Select (mydriver.findElement(By.xpath(".//*[@id='year']")));
year.selectByVisibleText(MyYear);
//Choose Male/Female radio button
mydriver.findElement(By.xpath(".//*[@id='u_0_e']")).click();
//Click on Signup
mydriver.findElement(By.xpath("div[@id='u_0_i']")).click();
search_result=mydriver.findElement(By.xpath(".//*[@id='reg_error_inner']")).getText();
System.out.println(search_result);
if (search_result.equals("Please choose a more secure password. It should be longer than 6 characters, unique to you, and difficult for others to guess.")){
System.out.println("Pass: error message exists on using unsecured and 6 characters long password");
} else {
System.out.println("Fail: error message does not exist on using unsecured password");
}
}