Element not found, but... is showing it!

Hi, i’m trying alarms and reminders in Android, when i set alarm in five minutes, the alarm puts a notification after that minutes and always contains the same text in the title. But when notification appears, appium usually not found that element. Can you help me? my code is here:

WebDriverWait wait = new WebDriverWait(driver, 360);

    wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//android.widget.TextView[@resource-id='android:id/title' and contains(@text, '"+text+"')]")));
                driver.findElement(By.xpath("//android.widget.TextView[@resource-id='android:id/title' and contains(@text, '"+text+"')]")).click();

Thank you


Before of last code, I open notificaction list with:


Are you sure that is the xpath? You are using Appium Inspector Mode correct?

Hello Jackson, thank for yout answer, I added more information:

The Tests with my personal device is always successful, but in TestObject/SauceLabs (https://app.testobject.com) a device farm, usually gives a error and sometimes is success, when i check results, I watched video recorder result and always appear notification:

org.openqa.selenium.TimeoutException: Expected condition failed: waiting for presence of element located by: By.xpath: //android.widget.TextView[contains(@text, 'Breakfast')] (tried for 360 second(s) with 500 milliseconds interval)