Element can be found by inspector but not by code

Platform: Android
Appium version:1.22.3
Client langauage:Python
OS: Windows

Hello, I found a very strange issue: When initiating session from Appium Inspector, specific element(confirm box with confirm/cancel button)

But when running by code, element cannot be found(neither in page source). And run code in debug mode and attach to this session in Appium Inspector, element also cannot be found(neither in page source)

I tested on 3 local devices. On Samsung S9/Android 10, Vivo X30/Android 10 the code runs fine. On Redmi K50/Android 13 I have this issue. And on cloud provider(browserstack, lambdatest) I have this issue(only on one device I tested on Lambdatest the code sometimes runs fine)

Also I tested fine on simulator of Samsung Galaxy S8+ /android 7.1.2

I found someone else also encountered this issue, but seems it’s resolved when he rerun the case.