Need help with testing Andoid app with camera

1,051 views
Skip to first unread message

Calabash_Fan

unread,
Nov 27, 2012, 4:48:58 PM11/27/12
to calabash...@googlegroups.com
Hi guys,

My app opens up the camera and I have to click on the camera button to take a picture. Now, I'm not sure how to click on the Camera button.
Could you guys please help me?

Calabash_Fan

unread,
Nov 27, 2012, 5:26:49 PM11/27/12
to calabash...@googlegroups.com

I mean how to click  on the camera shutter button..

Jonas Maturana Larsen

unread,
Nov 28, 2012, 4:58:28 PM11/28/12
to calabash...@googlegroups.com
Hi

I don't know if that's possible at all. But you might be able to dig up a solution.
Let me know if you find something.

- Jonas

Calabash_Fan

unread,
Nov 29, 2012, 9:57:12 AM11/29/12
to calabash...@googlegroups.com
Thanks Jonas. Let me tell you what I did

1. I inspected the camera (opened by the app ) in the hierarchy viewer, it showed me that it has view with id "shutter_button", but when tried the step 

     Then I press view with id "shutter_button"
          it gave me the error...  no view with id shutter button found...
2.  I also tried to click on the co ordinates but I got the error messge, "Click cannot be completed"

I have also tried some other steps too.. but not sure why it is not able to identify the elements in the camera... Could you please give me some clues on  which direction I should move on..?

P.S : I have almost completed my project with Calabash  android & ios. I'm just stuck here. Any help appreciated.. 

Thanks & Regards,
Calabash Fan

Jonas Maturana Larsen

unread,
Dec 1, 2012, 4:12:38 PM12/1/12
to calabash...@googlegroups.com
When you are looking in hierarchy viewer can you see if you app is still the top most one?
If your app is starting the build in camera app to take the pictures there is unfortunately  no way that Calabash can interact with it.

Calabash_Fan

unread,
Dec 3, 2012, 5:38:41 PM12/3/12
to calabash...@googlegroups.com
Yeah, I understood the problem. 
So all I did now is.. instead off opening the camera activity .. I have put in some static images to pickup.. though it is not the right solution, for now it is solving the purpose...
Thanks Jonas. 
Could you please let me know, if in future you add some functions to support this?

Jonas Maturana Larsen

unread,
Dec 4, 2012, 8:07:14 AM12/4/12
to calabash...@googlegroups.com
Good you found a workaround.

I can't promise that I'll remember to tell you. But I'll make sure it is announced on the mailing list :)

Cheers,
Jonas

Annie

unread,
Dec 7, 2012, 2:05:56 PM12/7/12
to calabash...@googlegroups.com
Just out of curiosity, how did you use your static images? I can actually get my camera working (able to press the button and open it up) but I have more of a problem with the picture it needs to take...

katari lovaraju

unread,
Jul 17, 2013, 6:18:19 AM7/17/13
to calabash...@googlegroups.com
Hi,

I am having the same problem which you had. I was trying to take a picture using camera and upload. But after reading your posts I understood it is not possible. But you said there is a work around using Static images. I tried the same by trying to upload the images from the gallery. But i was not successful.
Could you please help me by explaining how you are successful in uploading an image.

Thanks,
Lova

Johanna Mantilla Duque

unread,
Jul 19, 2013, 1:50:30 PM7/19/13
to calabash...@googlegroups.com
I have the same problem. 

I want scan a QR code, how I can pass a static image to the camera?


--
You received this message because you are subscribed to the Google Groups "calabash-android" group.
To unsubscribe from this group and stop receiving emails from it, send an email to calabash-andro...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

prakash kumar

unread,
Sep 2, 2013, 6:50:42 AM9/2/13
to calabash...@googlegroups.com
Hello,

Can you please explain the steps that you followed to Pick up the static Image .

thanks,
Prakash

Liam

unread,
Oct 23, 2013, 2:48:33 PM10/23/13
to calabash...@googlegroups.com

Then (/^i take a picture from camera$/) do

    performAction('wait', 5) # waitfor 5 second

    system('adb shell input keyevent 27') # click take picture button

    performAction('wait', 5) # waitfor 5 second

end

add the above into your calabash_steps.rb file

-

then create a step in feature file  - Then i take a picture from camera 

p.j.

unread,
May 21, 2014, 11:20:42 AM5/21/14
to calabash...@googlegroups.com
That is a great command to take a photo. I am running into an issue where I need to confirm the photo after it has been taken, does anyone know if there is a adb keyevent to interact with that part? Or if there is any other way to interact with the system/query the screen. Thanks 

Jerry Tom

unread,
Jul 21, 2014, 6:32:55 AM7/21/14
to calabash...@googlegroups.com
Hi p.j.,

I have also run into the same issue as you mentioned above. Did you find any luck to confirm the image captured by the camera?

Shyukri Shyukriev

unread,
Jul 28, 2014, 5:24:53 AM7/28/14
to calabash...@googlegroups.com
I couldn't find a keycode to touch the done button after taking screenshot. http://codeforfun.wordpress.com/2014/02/26/android-device-automation-with-adb/
So my command uses tap.
To get the exact coordinates open uiautomation viewer  and see the bounds of the OK/Approve icon, do simple calculation to get the center and tap on it:

system('adb shell input tap 950 1600') -> Nexus 5 screen

sai krishna

unread,
Aug 6, 2014, 2:05:10 AM8/6/14
to calabash...@googlegroups.com
Hey, 

How is it possible to add a static image as i work with QR scan. This would be really helpful

sai krishna

unread,
Oct 7, 2014, 11:55:37 AM10/7/14
to calabash...@googlegroups.com
GUys , anyone who can help on how static images can be used
Reply all
Reply to author
Forward
0 new messages