Handle Alerts with more than 2 buttons

Hey guys,

I have an alert object in iOS that has more than 2 buttons. How can I choose the desired option.
Let’s say I have Option1, Option2 and Cancel button. I want to choose either Option1 or Option2.

alert.accept() just selects Option2 always.

Appreciate your help.


You can either click by its ID or xpath directly.

or you can use alert.dismiss() to click the other button.

That worked. Thanks @chrisjywu!