Unable to work with camera and gallery

Hello everyone

i am newbie to appium
I am not able to select image from gallery and not able to click snaps using camera.
Please help me

1 Like

https://radioactiveukrainian.com/2014/01/06/testing-a-camera-app-in-ios-simulator/

Thank you for your replay Sagar

I am working with android one
Is the code similar for both ?

Hi,

each android device will have its own implementation, so if you want to use camera/native gallery, you will have to identify the device and write a custom routine for each one.

p.e on LG Magna you can have:

if (capabilityDeviceName.equals(Constants.LG_MAGNA)) { //this is just how I identify per device_id
        UtilsHelper.sendCameraCode(capabilityDeviceName); //In here I send the KEYCODE_CAMERA event
        helper.waitForID("com.lge.camera:id/btn_ok").click(); //I tap on ok button to send pic back to my app
}

To send KEYCODE_CAMERA I’m using:

adb -s «device_id» shell input keyevent 27

https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_CAMERA

On some devices this wont work. On Moto X p.e. you need to send a tap on screen to take a picture.

camera is working now but the problem is having in nexus 5 and not able to choose image from gallery

It will have to be custom code :neutral_face:

Maybe you can try and find the launchActivity of gallery and call it and then just look for android.widget.ImageView and randomly select one. That may be easily adapted to different android galleries.

Other way is just open gallery in uituatomatorviewer and look for id’s / names and automate totally custom to that gallery

Can any one help here in accessing camera on IPAD and switching the session back to test app

@sagar.basutkar This link is not valid anymore, could you please help me and leave here the example or new link?