WaitforElement not showing as fail in the report if the element not found


I am using Appium Studio 11.7.103 and executed the scripts using eclipse.I had created my own framework for the android automation using pageobject model.
Problem: I am using below code.I am using this for the element to be visible and then continues the next functionality.
But the problem is after waiting if the element is not found the testcase fails and showing error in the eclipse console.But coming to the report it is displaying as pass.How to solve this issue I want to be failed if element not found.
public void waitforelement(By element){
WebDriverWait wait = new WebDriverWait(driver, 30);
}catch(Exception e){
Log_Message(“Unable to find the element”, “false”);


Can someone help me about this


Is your Assertion framework JUNIT or TESTNG ?? The wait.unit will throw a TimeoutException if the element is not found. Your exception handler will catch this and based on your code. This in of itself will not fail a test if JUNIT or TESTNG is being used.

If your code is using TESTNG for the assertion framework, you’d up date your exception handler with something like:

catch(Exception e){
Log_Message(“Unable to find the element”, “false”);

The assert will cause TESTNG to consider the test a failed test.


Thanks for the reply.I am using testng framework.I had changed and made some modification like removed implicity wait and using only explicit wait.So in explicit wait if I use 30 seconds,it will check for the element continuously for 30seconds.During that time if the element not found in the first check,the step in the report is displaying as fail but after second or third check if the element is found then the next step in the report is displayed as pass.But my testcase report showing as failed.How to solve this I want testcase to show as pass.


Please provide the code for us to look at