I'm trying to automate an Android test on a real device using Appium in which I have an App that in order to complete a registration will ask the user to take a Selfie, so when the user clicks this button the device camera opens up, the only thing that is missing is that I can't find a way to make the script make a click on the button to take a photo. enter image description here

Thank you!


@ASR7, No - I would like to correct below things

  1. We can not automate android mobile app automation using Selenium. Selenium is use to automate web/browser automation

  2. Facility in order to automate Android mobile app test case, one may use Appium

    3.1 BTW & Answer to your Q - It doesn't allow to identify elements from another android app.

    3.2 As one will not able to identify element of another app[2nd app or app which you might have opened from 1st your app] you can not make your script to click to take a selfie.


You can use driver.sendKeyEvent(KeyEvent.KEYCODE_CAMERA);

You can find the documentation and other key events codes at https://developer.android.com/reference/android/view/KeyEvent.html

  • 1
    can you expand your answer? Why is that a good solution?
    – ECiurleo
    Oct 6 '16 at 14:53
  • What does this add to the accepted answer?
    – Kate Paulk
    Oct 6 '16 at 15:27
  • It contradicts the accepted answer. I looked into the documentation and I think using the actual constant instead of the magic number makes it more clear. I don't know if it works, but it's a promising lead.
    – corsiKa
    Oct 6 '16 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.