2

I'm trying to automate an Android test on a real device using Appium in which I have an application.

In order to complete a registration, the application 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 how to click on the button to take a photo.

Any ideas?

enter image description here

1
  • How to write script for camera functionality for android devices. The script will run in any mobile devices not in any specific. The UI and functionality of every devices is different.
    – Abhjeet
    Commented Jan 24 at 7:00

2 Answers 2

1

@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.

0

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

3
  • 1
    can you expand your answer? Why is that a good solution?
    – ECiurleo
    Commented Oct 6, 2016 at 14:53
  • What does this add to the accepted answer?
    – Kate Paulk
    Commented Oct 6, 2016 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
    Commented Oct 6, 2016 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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