Skip to content
This repository has been archived by the owner on Dec 26, 2019. It is now read-only.

Error copying attributes #372

Closed
toejough opened this issue Nov 15, 2016 · 89 comments
Closed

Error copying attributes #372

toejough opened this issue Nov 15, 2016 · 89 comments

Comments

@toejough
Copy link

The same error under the same conditions as #357. Opening a new issue because that was closed as resolved by the author after the last visibility fix, so I'm assuming that this is a related, but different, root cause.

Relevant log:

[HTTP] --> GET /wd/hub/session/d0652778-1c1a-40ef-a61c-93e2674bad8b/source {}
[MJSONWP] Calling AppiumDriver.getPageSource() with args: ["d0652778-1c1a-40ef-a61c-9...
[debug] [XCUITest] Executing command 'getPageSource'
[JSONWP Proxy] Proxying [POST /source] to [POST http://localhost:8100/session/C34425C6-49B2-47B2-A2DC-894EF06195ED/source] with no body
[debug] [WebDriverAgent] Sim: Nov 14 09:39:09 vision XCTRunner[45364]: Enqueue Failure: UI Testing Failure - Failure fetching attributes for element <XCAccessib
ilityElement: 0x61000024c510> Device element: Error Domain=XCTestManagerErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} <unknown> 0 1

I'm happy to try any suggested code edits, but I don't know enough about obj-c or XCUI test itself to dig around too much on my own at the moment.

I'd also be happy to have missed a step in updating this project under Appium. I've followed the steps I outlined for a successful update in #317, as well as here and here

@mykola-mokhnach
Copy link
Contributor

Try to merge this PR to your local source and then add waitForNoAnimationsActive API call before to locate the corresponding element. It looks like XCTest does not like when one reads attributes while on-screen animation is active in the corresponding container. That is why it is necessary to make sure all the animations have been finished before to locate the corresponding element and read its attributes.

@toejough
Copy link
Author

Thanks! I'll give that a shot today!

@toejough
Copy link
Author

toejough commented Nov 16, 2016

Nope.

I called that API before every call to page source, verified I got 200's back, and I still got

[HTTP] --> GET /wd/hub/session/c69af69b-91bf-4cda-b216-4eaa53bfcc7d/source {}
[MJSONWP] Calling AppiumDriver.getPageSource() with args: ["c69af69b-91bf-4cda-b216-4...
[debug] [XCUITest] Executing command 'getPageSource'
[JSONWP Proxy] Proxying [POST /source] to [POST http://localhost:8100/session/98821366-F49B-4B0C-9355-BD1EF1B0DEC6/source] with no body
[debug] [XCUITest] Waiting for WebDriverAgent server to finish loading...
[debug] [WebDriverAgent] Sim: Nov 16 15:04:04 vision XCTRunner[5398]: Enqueue Failure: UI Testing Failure - Failure fetching attributes for element <XCAccessibilityElement: 0x61000025af70> Device element: Error Domain=XCTestManagerErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} <unknown> 0 1

This particular spot is a gmail auth screen in a webview - there's really nothing animating.

The odd thing is that when this happens, subsequent page source requests go through immediately. If it helps debugging, the page source in this case is here.

@toejough
Copy link
Author

screenshot to go along with the source:
screen shot 2016-11-16 at 3 18 44 pm

@mykola-mokhnach
Copy link
Contributor

What if you just add hardcoded sleep to make sure the webview has been successfully loaded before invoking getPageSource?

@marekcirkos marekcirkos changed the title Error copying attributes (still) Error copying attributes Nov 17, 2016
@marekcirkos
Copy link
Contributor

@toejough Can you change this method too always return NO and check if you still having this error?

@toejough
Copy link
Author

always returning NO got me through my login screens so fast I wasn't ready for it! I've been trying to follow the visibility conversation - does this mean that there are some other checks to add to that method?

@toejough
Copy link
Author

Personally, I can live with this. any incorrect visibility states that arise in my test code can be dealt with much more easily than those long timeouts.

Thank you very much for your attention and work on this!!

@muratme
Copy link

muratme commented Dec 5, 2016

any update about this issue?

@prahladsharma007
Copy link

Hi all,

Any update for fixing of this issue. Our Automation is stuck due to this.

@marekcirkos
Copy link
Contributor

@prahlad06, @muratme Still in progress. You could help us by creating test case that will raise this issue in situation you are facing.

@mykola-mokhnach
Copy link
Contributor

This is what I did for my local source and I don't see that bloody error anymore. Please try this patch for your local WDA sources and see whether the problem is fixed and there are no new issues pop up:

File WebDriverAgentLib/Categories/XCUIElement+FBIsVisible.m

replace the content of (BOOL)fb_isVisible method with

- (BOOL)fb_isVisible
{
  return !CGRectIsEmpty(self.frame) && !CGRectIsEmpty(self.visibleFrame);
}

@mykola-mokhnach
Copy link
Contributor

I'll create a PR if you confirm the fix works and does not create additional problems with visibility detection.

@toejough
Copy link
Author

toejough commented Dec 6, 2016

ooh, I'll give this one a try today.

@marekcirkos
Copy link
Contributor

@mykola-mokhnach You will definitely have problems with iOS 9.x. As I already tried similar approach. Main problem was that lots of invisible cell were reported with frames in top right corner with proper size.

However I think in iOS 10.x it has good chance of working as Apple stopped reporting weird cell cases.

@mykola-mokhnach
Copy link
Contributor

@marekcirkos What if we check the actual OS version and use the current approach for the old version only (9.X)? Anyway, more than 80% of WDA users already run their tests on 10.0+.

@mykola-mokhnach
Copy link
Contributor

@toejough did the patch work for you?

@KBhatti
Copy link

KBhatti commented Apr 19, 2017

Yes, and some of it seems stuff that I was easily getting to work with 1.6.3...I keep getting "[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]"

@fancychimp
Copy link

fancychimp commented Apr 26, 2017

@mykola-mokhnach I would like to apply your fix locally. I go open up the WebDriverAgent project in Xcode and go to WebDriverAgent > PrivateHeaders > XCTest but I'm failing to find the file named XCUIElement+FBIsVisible.m. Could you anyone please help me locate it?

Also, do I simply paste this in there?

@@ -9,6 +9,7 @@
 
 #import "XCUIElement+FBIsVisible.h"
 
+#import "FBMathUtils.h"
 #import "XCElementSnapshot+FBHelpers.h"
 #import "XCTestPrivateSymbols.h"
 
@@ -29,18 +30,10 @@
 - (BOOL)fb_isVisible
 {
   if (CGRectIsEmpty(self.frame) || CGRectIsEmpty(self.visibleFrame)) {
-    /*
-     It turns out, that XCTest triggers
-       Enqueue Failure: UI Testing Failure - Failure fetching attributes for element
-       <XCAccessibilityElement: 0x60000025f9e0> Device element: Error Domain=XCTestManagerErrorDomain Code=13
-       "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} <unknown> 0 1
-     error in the log if we try to get visibility attribute for an element snapshot, which does not intersect with visible appication area
-     or if it has zero width/height. Also, XCTest waits for 15 seconds after this line appears in the log, which makes /source command
-     execution extremely slow for some applications.
-     */
     return NO;
   }
-  return [(NSNumber *)[self fb_attributeValue:FB_XCAXAIsVisibleAttribute] boolValue];
+  CGSize screenSize = FBAdjustDimensionsForApplication(self.application.frame.size, self.application.interfaceOrientation);
+  return CGRectIntersectsRect(self.visibleFrame, CGRectMake(0, 0, screenSize.width, screenSize.height));
 }
 
 @end




Is there another alternative? I am on Appium version 1.6.4, but I know the problem is not with Appium. Is there a way to upgrade WebDriverAgent, or any other solution I should be trying?

Thank you for any help.

@marekcirkos
Copy link
Contributor

How is stuff now? Can we consider it fixed?

@toejough
Copy link
Author

toejough commented Jul 25, 2017

Based on the last comments, no? It'd be good if some of the other participants responded.

I'm responding because I opened the issue, but personally, I had to get things working so I wrote custom installation scripts to do the visibility code patching back in November.

If this is just waiting on me, you can close it, because I've been doing fine with that workaround, but it'd be good to hear from others who've had the problem if it's still a thing they fight with or not.

@vmaxim
Copy link

vmaxim commented Aug 4, 2017

@marekcirkos

WebDriverAgent --HEAD
Appium v1.6.6-beta.3
XCode 9 beta 4
iOS 11.0 Simulator

logs

@fancychimp
Copy link

Not fixed, still hitting this issue

Enqueue Failure: UI Testing Failure - Failure fetching attributes for element Device element: Error Domain=XCTDaemonErrorDomain Code=13

WebDriverAgent --HEAD
Appium 1.6.4
Xcode 8.3
iOS 10.3.1

@Dheepthi
Copy link

Dheepthi commented Sep 25, 2017

Yes i get the same issue in my app, with Appium 1.7.0
I'm facing this issue 100 % of times.

This is a blocker for us in executing automation on iOS 10.x and 11.x versions.

Any possible fix?

#730

@clpluie
Copy link

clpluie commented Nov 21, 2017

Has anyone came cross this situation:
Enqueue Failure: Failure getting snapshot Error Domain=XCTDaemonErrorDomain Code=9 "Error -25204 getting snapshot for element <AXUIElement 0x10dd51620> {pid=2597}" UserInfo={NSLocalizedDescription=Error -25204 getting snapshot for element <AXUIElement 0x10dd51620> {pid=2597}}

@shynkevich-alex
Copy link

  • appium 1.7.2-beta
  • iOS 11 Real device
  • xCode 9.1

I have the same issue when test opens menu with animation.
WDA starts hang after opening menu even when I do not send requests.

[Xcode] 2017-11-22 08:29:20.440897+0300 XCTRunner[16994:677063] Enqueue Failure: Failed to get snapshot within 15.0s /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1 [Xcode] 2017-11-22 08:29:35.500261+0300 XCTRunner[16994:677063] Enqueue Failure: (null) /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1 [Xcode] 2017-11-22 08:29:42.482745+0300 XCTRunner[16994:679727] Enqueue Failure: Failure getting snapshot Error Domain=com.apple.dt.xctest.automation-support.error Code=8 "Error getting main window -25216" UserInfo={NSLocalizedDescription=Error getting main window -25216} <unknown> 0 1 [Xcode] 2017-11-22 08:29:42.487595+0300 XCTRunner[16994:677063] Enqueue Failure: Neither attributes nor error returned /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1 [Xcode] 2017-11-22 08:29:42.487826+0300 XCTRunner[16994:677063] Enqueue Failure: Failure to determine system application: (null) /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1 [Xcode] 2017-11-22 08:29:42.512396+0300 XCTRunner[16994:677063] Enqueue Failure: Failure fetching attributes for element (null): Error Domain=XCTDaemonErrorDomain Code=9 "No AXElement found for (null)" UserInfo={NSLocalizedDescription=No AXElement found for (null)} /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1 [Xcode] 2017-11-22 08:29:42.512667+0300 XCTRunner[16994:677063] Enqueue Failure: Failure getting list of active applications: (null) /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1 [Xcode] t = 369.51s Find the Application "com.testapp" 0x1c40b75e0

@SamyQAZ
Copy link

SamyQAZ commented Dec 12, 2017

Appium.app: 1.2.7 (1.2.7)
Appium CLI: 1.7.1
Desktop OS/version used to run Appium: 10.12.6(macOS Sierra)

Same issue occurs on my side too, throwing same logs mentioned by @shynkevich-alex
Struggling since a week to make it work. This happens when appium inspector is used to locate elements. Not sure which WDA version I am using. Havent yet updated to latest. Is it required to update WDA frequently?

LOGS:

[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.759763+0800 WebDriverAgentRunner-Runner[233:5923] Enqueue Failure: Failure fetching attributes for element  pid: 53, elementOrHash.elementID: 4423314256.93: Error Domain=XCTDaemonErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1
[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.760688+0800 WebDriverAgentRunner-Runner[233:5923] Failed to fetch hit point for Other, 0x17418f220, traits: 8589934592, {{187.5, 379.0}, {0.5, 44.0}} - *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.769090+0800 WebDriverAgentRunner-Runner[233:5923] Enqueue Failure: Failure fetching attributes for element  pid: 53, elementOrHash.elementID: 4423313840.92: Error Domain=XCTDaemonErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1
[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.770047+0800 WebDriverAgentRunner-Runner[233:5923] Failed to fetch hit point for Other, 0x17418f150, traits: 8589934592, {{187.5, 379.0}, {0.5, 44.0}} - *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.777984+0800 WebDriverAgentRunner-Runner[233:5923] Enqueue Failure: Failure fetching attributes for element  pid: 53, elementOrHash.elementID: 4423314256.93: Error Domain=XCTDaemonErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1
[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.778818+0800 WebDriverAgentRunner-Runner[233:5923] Failed to fetch hit point for Other, 0x17418f220, traits: 8589934592, {{187.5, 379.0}, {0.5, 44.0}} - *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.786240+0800 WebDriverAgentRunner-Runner[233:5923] Enqueue Failure: Failure fetching attributes for element  pid: 53, elementOrHash.elementID: 4363516560.90: Error Domain=XCTDaemonErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1
[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.787156+0800 WebDriverAgentRunner-Runner[233:5923] Failed to fetch hit point for Other, 0x17418f2f0, traits: 8589934592, {{188.0, 379.0}, {134.5, 44.0}} - *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
[2017-12-12 02:21:00][Xcode] 2017-12-12 14:20:58.793398+0800 WebDriverAgentRunner-Runner[233:5923] Enqueue Failure: Failure fetching attributes for element  pid: 53, elementOrHash.elementID: 4423287600.94: Error Domain=XCTDaemonErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgentRunner/UITestingUITests.m 37 1

Does anyone know how to resolve this?

@tfcardoso
Copy link

@marekcirkos I just encountered this issue. Nothing more will be attempted to resolve this issue? Thanks

@ankit9289
Copy link

what is the resolution here ?? any updates ??

@amit-punjabi
Copy link

still facing the same issue. do we have any update on when this will be fixed?

@Nischalapp
Copy link

Nischalapp commented Apr 9, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests