How to click on "Cancel" button to close webpage in IOS

Hi All,

Any pointers as how to click on “Cancel” button to close webpage in IOS? It is not the part of webpage as I could not able to inspect it.


And when I am trying to access its id through appium inpector, appium is not loading this page, so I am currently block because I need to verify clicking on “Cancel” button moves the user back to the first screen of the app.
In android, I was able to successfully achieve that because in android there is “X” button instead of cancel and I was able to fetch its ID from appium inspector.

Can someone please suggest me what should I do in case of IOS? How can I click on “Cancel” button?

try simple way first with strategy:

iOSNsPredicate = "label='Cancel' OR value='Cancel'"

NB! make sure you are in NATIVE context!