# How to click OK button in android device after taking a picture?

**URL:** <https://discuss.appium.io/t/how-to-click-ok-button-in-android-device-after-taking-a-picture/26050>\
**Category:** Support\
**Created:** [April 18, 2019, 10:35am UTC](https://discuss.appium.io/t/how-to-click-ok-button-in-android-device-after-taking-a-picture/26050 "2019-04-18T10:35:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shay7](https://discuss.appium.io/letter_avatar_proxy/v4/letter/s/df788c/32.png) [@shay7](https://discuss.appium.io/u/shay7)\
**Post date:** [April 18, 2019, 10:35am UTC](https://discuss.appium.io/t/how-to-click-ok-button-in-android-device-after-taking-a-picture/26050/1 "2019-04-18T10:35:39Z")

</div>

Hello,  
In order to take a picture in android device i use the following code:  
getDriverWrapper().getAndroidDriver().pressKeyCode(KEYCODE\_CAMERA);

If I want to save the picture then I need to click on OK button.  
I can click on the OK button using id, but the thing is that in every phone I have a different id. I run my tests on aws device farm, and since I don’t know on which device the code will run, is there a way to press OK on every android device my code will run?  
A KEY\_CODE or something like that?

Thanks

---

<div class="post-metadata">

**Author:** ![johny](https://discuss.appium.io/user_avatar/discuss.appium.io/johny/32/6421_2.png) [@johny](https://discuss.appium.io/u/johny)\
**Post date:** [September 23, 2019, 4:00am UTC](https://discuss.appium.io/t/how-to-click-ok-button-in-android-device-after-taking-a-picture/26050/2 "2019-09-23T04:00:16Z")

</div>

maybe you can try to use find\_element\_by\_android\_uiautomator(“new UiSelector().text(%s)”) method.  
it works to me.
