How to handle appium findelements timeout

I am trying to find an element(application popup, not system popup) which is not present on the screen (To check whether element is present or not). But Appium is waiting for more than 2 minutes to find an element with different strategies. Even I tried with findElement() but no luck.

After 90 secs I see the same popup and test is failing saying popup is present.

I don’t have any implicit waits in the script. Below is the applium log.
Appium version: 5.0.4

My code:

public boolean isElementPresent(PageElement element) {
    driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
    try {
        driver.findElement(by)
        return true;
    } catch (NoSuchElementException e) {
        return false;
    }
}

2018-06-25 14:11:54:030 - [debug] [MJSONWP] Calling AppiumDriver.timeouts() with args: [“implicit”,0,“fa9327bc-d5c4-4347-9ef6-5b2ca24e5409”]
2018-06-25 14:11:54:032 - [debug] [BaseDriver] Set implicit wait to 0ms
2018-06-25 14:11:54:033 - [debug] [MJSONWP] Responding to client with driver.timeouts() result: null
2018-06-25 14:11:54:034 - [HTTP] <-- POST /wd/hub/session/fa9327bc-d5c4-4347-9ef6-5b2ca24e5409/timeouts 200 4 ms - 76
2018-06-25 14:11:54:036 - [HTTP] --> POST /wd/hub/session/fa9327bc-d5c4-4347-9ef6-5b2ca24e5409/element {“using”:“id”,“value”:“parentPanel”}
2018-06-25 14:11:54:037 - [debug] [MJSONWP] Calling AppiumDriver.findElement() with args: [“id”,“parentPanel”,“fa9327bc-d5c4-4347-9ef6-5b2ca24e5409”]
2018-06-25 14:11:54:037 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-06-25 14:11:54:038 - [debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
2018-06-25 14:11:54:038 - [debug] [BaseDriver] Waiting up to 0 ms for condition
2018-06-25 14:11:54:038 - [debug] [AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“parentPanel”,“context”:"",“multiple”:false}}
2018-06-25 14:11:54:040 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“parentPanel”,“context”:"",“multiple”:false}}
2018-06-25 14:11:54:040 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
2018-06-25 14:11:54:041 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
2018-06-25 14:11:54:041 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding ‘parentPanel’ using ‘ID’ with the contextId: ‘’ multiple: false
2018-06-25 14:11:54:042 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=uk.co.santander.spendlytics.offline:id/parentPanel]
2018-06-25 14:14:01:855 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=android:id/parentPanel]
2018-06-25 14:17:18:838 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=parentPanel]
2018-06-25 14:17:19:338 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[DESCRIPTION=parentPanel, INSTANCE=0]
2018-06-25 14:17:19:342 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
2018-06-25 14:17:19:343 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding ‘parentPanel’ using ‘ID’ with the contextId: ‘’ multiple: false
2018-06-25 14:17:19:343 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=uk.co.santander.spendlytics.offline:id/parentPanel]
2018-06-25 14:17:19:348 - [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“17”}}
2018-06-25 14:17:19:348 - [debug] [AndroidBootstrap] Received command result from bootstrap
2018-06-25 14:17:19:348 - [debug] [MJSONWP] Responding to client with driver.findElement() result: {“ELEMENT”:“17”}
2018-06-25 14:17:19:350 - [HTTP] <-- POST /wd/hub/session/fa9327bc-d5c4-4347-9ef6-5b2ca24e5409/element 200 325322 ms - 88

Can someone help me with this please?

i am also facing the same issue with appium 1.7.2 with java client 5.0.4. even though element is not present appium is trying to find the element for almost 20 sec.
is there any way to customize the wait.

Can you share the complete appium log trace of your execution ?

Also, According to your logs, the automation strategy for new driver( UiAutomator2 driver) is not set in your script.

So ,if you are using android device with OS version 6.0 and above
then add the below capability and re-execute your script again.

caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, “uiAutomator2”);

With ‘AUTOMATION_NAME’ capability, current issue is resolved but my tests are not working as expected.

Like entering text in a password field is being not masked. Not sure what causing this issue.

I am working on it and will update once issues are resolved.

Test execution is fast compared automationName with ‘Appium’ (default). It is the reason tests are not waiting till the screen is finished loading.

I put explicit wait in place and now looks fine.