I want to check element existence on screen

I want to check any element with XPath.
I am implement my test application in JAVA, for iOS application testing.

I go through with several other post to on the same and tried but could not make worked for me :frowning:
tried solution are :

Someone help me out from this problem.

for i OS better use native predicate instead of XPATH:

List<IOSElement> elementList = driver.findElements(MobileBy.
                iOSNsPredicateString("type == 'XCUIElementTypeStaticText' AND name == '" + name + "' AND visible == 1"));
        if (!elementList.isEmpty()) {
             // element found on screen

Ok and what we can do with popups which are asking to permission(e.g. bluetooth, Location, camera).

i used this code for android automation but it is not working
if(driver.findElement(By.xpath("//*[@text,‘You buy’]")).isDisplayed()){