Black screen when taking picture on camera during automation run.(emulator)

During automation run when it clicks on ‘take picture’ button it opens a black screen with one button which automation is able to locate and click, but it does nothing. Note: Manually works fine. Automation was working fine as well before. All of a sadden we started facing this issue.
Instead of that black screen there should be another page with an option to take a picture or to cancel. There wasn’t any version change from developers side etc.

Appium version 1.18.2 also tried 1.13 and 1.14
Node.js version : v14.4.0

Attached is the screenshot of that issue.
I appreciate any help in advance.

First, the screenshot you share is not black, but has a transition wheel in the middle. This indicates that you are taking a screenshot before the screen has finished rendering.

This is a race condition, and to stabilize it you need to verify that the screen is rendered before taking the screenshot. My suggestion would be to verify at least one element on the screen before taking the screenshot.

Hi @wreed, thank you for your comment !
I tried to put different wait times. it circles forever.
Sorry I had to mention it also. I couldn’t attach recording of it.
Basically that wheel is just there circling and at the end test is failing when the wait time ends.

Hi @sguliza, sorry if I misunderstood the original problem. So let me get this straight:

when you are automating the camera, it’s only shows this black screen.

I originally thought you were trying to get a screenshot and were in some transitional state. Sorry about that.

So do you have access to this device? Can you see that it works normally on this device when using manually? Also, can you post some logs?

ohh no, you are good :slight_smile: Thank you @wreed for your help. I appreciate it !
I think I didn’t add enough information in the first place.

So, yes, manually it’s working fine and I’m getting following page where I click on that camera icon and it’s taking a pic.

but with automation I’m getting only that black screen with that circling wheel and the camera icon :frowning:

Ok, I’m kind of stuck without logs. But sans that, here is what I would try:

  1. Reboot device
  2. Reboot automation computer (where appium runs)
  3. Check all settings on device, for example could usb debugging be turned off?
  4. Look for what changed*

*You have said that this was working and suddenly stopped. Did you update any components (Appium, Node, Android SDK, etc). Also, could there have been any changes to your automation code that might explain this.

This is pretty standard troubleshooting so you may have done some (or all) of this already. Probably best to post some logs.

ohh, sorry, I forgot to mention that there is no logs. Automation is failing because it can’t find the next locator (org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.)
or if I put wait time it just waits without failing :frowning:

  1. I have tried rebooting the device.
  2. Tried to reboot computer as well :slight_smile:
  3. Also I tried different emulators and other automation engineer also getting this issue so I guess it’s not the emulator settings issue.
  4. I guess I need to dig here more.

I don’t remember updating any of those components.

Thank you @wreed! I appreciate your help !