# Screenshot errors with Espresso

**URL:** <https://discuss.bitrise.io/t/screenshot-errors-with-espresso/5214>\
**Category:** Question & Answer\
**Created:** [May 29, 2018, 8:20pm UTC](https://discuss.bitrise.io/t/screenshot-errors-with-espresso/5214 "2018-05-29T20:20:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blane-mdsol](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@blane-mdsol](https://discuss.bitrise.io/u/blane-mdsol)\
**Post date:** [May 29, 2018, 8:20pm UTC](https://discuss.bitrise.io/t/screenshot-errors-with-espresso/5214/1 "2018-05-29T20:20:39Z")

</div>

Hello! I’m using Espresso for automated tests in Android, using the UiDevice [takeScreenshot()](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice.html#takeScreenshot(java.io.File)) method.

However, some of my screenshots work and some of them don’t. I’d say the majority of the screenshots I get only show the home screen.

Is there a reason for this? Is it possible that the tests are running so fast that the app is closing before the screenshot is taken?

Any help is appreciated, thanks!

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [June 2, 2018, 6:03pm UTC](https://discuss.bitrise.io/t/screenshot-errors-with-espresso/5214/2 "2018-06-02T18:03:00Z")

</div>

Hi @blane-mdsol,

For reliable Espresso UI tests I’d suggest you to try our **Virtual Device Testing** feature, which runs the tests on Firebase Test Lab: [https://blog.bitrise.io/introducing-solid-and-snappy-virtual-device-testing-for-android](https://blog.bitrise.io/introducing-solid-and-snappy-virtual-device-testing-for-android)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/d/d901cf2aad020f2dd11918afc89ec2089bb87b35.png) [@system](https://discuss.bitrise.io/u/system)\
**Post date:** [July 2, 2018, 6:03pm UTC](https://discuss.bitrise.io/t/screenshot-errors-with-espresso/5214/3 "2018-07-02T18:03:11Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
