16

I am getting following error during a UI test (using simulator for iPhone 6):

Assertion Failure: UI Testing Failure - Failure getting snapshot Error
Domain=XCTestManagerErrorDomain Code=9 "Error -25204 getting snapshot
for element <AXUIElement 0x7fbd6be217d0> {pid=6874}"
UserInfo={NSLocalizedDescription=Error -25204 getting snapshot for
element <AXUIElement 0x7fbd6be217d0> {pid=6874}}

<unknown>:0: error: -[*screen name*] : UI Testing Failure - Failure
getting snapshot Error Domain=XCTestManagerErrorDomain Code=9 "Error
-25204 getting snapshot for element <AXUIElement 0x7fbd6be217d0> {pid=6874}" UserInfo={NSLocalizedDescription=Error -25204 getting
snapshot for element <AXUIElement 0x7fbd6be217d0> {pid=6874}}

The scene is similar to other scenes where UI testing works correctly. So, I am not sure why there is an error getting snapshot for some element.

I checked using Accessibility Inspector, and all elements seem to have an identifier.

This with Xcode Version 7.3 (7D175).

Markus W Mahlberg
  • 19,711
  • 6
  • 65
  • 89
Hasaa2 Khidala
  • 161
  • 1
  • 3
  • little formatting would help others to understand question better. – Aman Gupta May 08 '16 at 07:30
  • Thanks agpt. Hope someone could clarify the what can cause Error -25204 getting snapshot for element. – Hasaa2 Khidala May 08 '16 at 17:41
  • Did you find a solution? – osrl May 26 '16 at 08:39
  • No, I haven't been able to find a solution yet. I also posted this issue on Apple developer forum, but haven't received any insights yet.In case you find any, please let me know as well. – Hasaa2 Khidala May 26 '16 at 19:43
  • I have the same issue when running tests on travis-ci but the tests pass locally – wasabi Jul 11 '16 at 19:15
  • Any solution for this? Have the same issue. Fighting with above from weeks. – Bartłomiej Semańczyk Aug 11 '16 at 10:21
  • here is the sample project in case anyone interested on this bug https://drive.google.com/file/d/0B7J8nMIupS79VnlBS1g4cVZJaWc/view?usp=sharing – hoangpx Aug 11 '16 at 17:53
  • We have the same problem, this damn -25204. By binary searching the origin, I see that if I remove 4 labels from one of the table cell, this problem disappear... but if I recreate one, my problem comes back... very strange issue. – smad Nov 07 '16 at 15:01
  • @hoangpx Are you still having this issue? I just tried downloading your project from Google Drive, and I can't recreate the issue in Xcode Version 7.3 (7D175)? The test succeeds. – Frederik Mar 22 '17 at 17:15
  • @Frederik This's weird. The error is gone. But this error still happens randomly sometimes (not in this sample) on my test project on xcode 8.1 – hoangpx Mar 28 '17 at 17:02
  • @hoangpx That seems weird! Have you tried updating to Xcode 8.3 to check if this was a bug in Xcode that has gotten fixed? – Frederik Mar 29 '17 at 05:42
  • @Frederik I can't, because my project has ~300 testscripts working with swift 2.3 . To upgrade to xcode 8.2 or 8.3 it'll take a lot of time to convert them to swift 3.0 in order to run. I'm tired of tracing swift version. – hoangpx Mar 29 '17 at 17:28
  • @hoangpx That seems fair. I had the same issue with table views in my own project, where there was a "load more" function that would trigger, if you scrolled down. Apparently Xcode triggered it during UI test, so it kept loading more cells into memory, and eventually the UI test would fail, since it took to long to find the specific cell. Disabling the "load more" feature in UI testing environment did the trick for me. Not sure if you have the same problem, it could be something completely different, but I am not sure what it could be. – Frederik Mar 29 '17 at 21:33
  • @Frederik I have exactly the same problem then I did the same thing to work around. The error -25204 is not specific for one problem, It happens randomly with different approaches. I run my testscripts 24/24 and this error happens at least one a day. But I realized the faster your computer is the less error occurred. – hoangpx Mar 29 '17 at 21:54
  • @hoangpx As crappy as it may be, that sounds totally legit. – Frederik Mar 30 '17 at 09:28

0 Answers0