I am automating an android hybrid application using appium. This application is a news app and displays ads randomly. So when the ad pops up my script gets failed with element not found exception. To overcome this issue I have added try catch block.when the NoSuchElement exception occurs a logic is written in the catch block to close the ad and then the test is continued.
But i found it is not feasible to add try catch block in all test methods. there are 100 plus test methods, which in turn increase my code size and not a professional approach.
I request experts help for a better solution.