Issue at clicking on action sheet in iOS

In my application there is image upload option, On clicking upload image an action sheet will be opened with two options Gallery,Camera.The issue is on clicking upload image button it automatically clicking the first option in action sheet which is camera option.But I want to click on second option which is Gallery.

1 Like

I am also facing the same problem. Have u find any solution?

I asked the developer to place gallery option top,Problem solved though this is not right way.

Also experiencing the same problem. Is there anyway of selecting any other option in an action sheet rather than just the first item?

I am able to click the buttons by Accessibility Ids

I have two buttons >> Take A Photo and Choose from Library

driver.findElement(By.id(“Choose from Library”)).click();

Above one works for me.

Yours will be working like

driver.findElement(By.id(“Gallery”)).click();

I found that by removing ‘autoAcceptAlerts’: ‘true’ from my environment setup allowed me to access the different elements in the action sheet…

2 Likes

In your driver’s DesiredCapabilities, Please remove ‘AUTO_ACCEPT_ALERTS’ Capability or set it to false. Action sheet is considered as an alert and first item in sheet is tapped to accept the alert.

Not sure whether it is an appium feature or ios bug.

Hi There,
I am having the same issue. In my case, I have two buttons “Photo Library” (top button and this is what I need to select) and “Cancel” bottom button. My test always selects (bottom) “Cancel” button. Even though accessibility ID is correct. For a work around, I changed the code locally that “Photo Library” to the bottom button then it get selected. But this is not the ideal scenario, I need to find out the way how to select “Photo Library” button without changing the position.
Also, if I search for this element in appium desktop using accessibility id, element can be found and can do tap on it. Why it is not working when I run the code?
Also, I can’t disable ‘AUTO_ACCEPT_ALERTS’ Capability, since I have couple of alerts needs to be dismissed. So set it as true.
Please help me on this.
Thank you in advance!
Here is the screenshot of the page I am having trouble to find element.

yup,I’m doing the same

possible solution
http://appium.io/docs/en/advanced-concepts/settings/