I am working on the Web Application, In that Application user need to send the values into
the Search Text Box, then user need to click on the Search Button, If the Value are
avilable in the db, then that value will be display on the another Text Box, If that value
in not in the db, Then Alert Pop up is Displaying on the screen, At that i am using below
code, But it is not working fine.
if(driver.findElement(By.id(APL.MT_ET_Search_Btn_ID)).isEnabled())
{
driver.findElement(By.id(APL.MT_ET_Search_Btn_ID)).click();
System.out.println("Clicked on the Search Button for the Text box");
Thread.sleep(2000);
//Handling the Code
String page = driver.getTitle();
System.out.println(page);
if(page.equals("No Recipients found"));
{
System.out.println("No Recipients found");
driver.switchTo().alert().accept();
System.out.println("Handling the Pop Up");
}
}
You have an error in the second if, remove the semicolon and it will be better.
if(driver.findElement(By.id(APL.MT_ET_Search_Btn_ID)).isEnabled())
{
driver.findElement(By.id(APL.MT_ET_Search_Btn_ID)).click();
System.out.println("Clicked on the Search Button for the Text box");
Thread.sleep(2000);
//Handling the Code
String page = driver.getTitle();
System.out.println(page);
if(page.equals("No Recipients found")) //#############HERE
{
System.out.println("No Recipients found");
driver.switchTo().alert().accept();
System.out.println("Handling the Pop Up");
}
}
Anyway if you please tell us WHY is not working I can check if there can be other problems.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.