New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error copying attributes #372

Closed
toejough opened this Issue Nov 15, 2016 · 86 comments

Comments

Projects
None yet
@toejough

toejough commented Nov 15, 2016

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

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Nov 16, 2016

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.

Contributor

mykola-mokhnach commented Nov 16, 2016

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

This comment has been minimized.

Show comment
Hide comment
@toejough

toejough Nov 16, 2016

Thanks! I'll give that a shot today!

toejough commented Nov 16, 2016

Thanks! I'll give that a shot today!

@toejough

This comment has been minimized.

Show comment
Hide comment
@toejough

toejough 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 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

This comment has been minimized.

Show comment
Hide comment
@toejough

toejough Nov 16, 2016

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

toejough commented Nov 16, 2016

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

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Nov 17, 2016

Contributor

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

Contributor

mykola-mokhnach commented Nov 17, 2016

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

@marekcirkos marekcirkos changed the title from Error copying attributes (still) to Error copying attributes Nov 17, 2016

@marekcirkos

This comment has been minimized.

Show comment
Hide comment
@marekcirkos

marekcirkos Nov 17, 2016

Contributor

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

Contributor

marekcirkos commented Nov 17, 2016

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

@toejough

This comment has been minimized.

Show comment
Hide comment
@toejough

toejough Nov 17, 2016

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 commented Nov 17, 2016

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

This comment has been minimized.

Show comment
Hide comment
@toejough

toejough Nov 17, 2016

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!!

toejough commented Nov 17, 2016

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

This comment has been minimized.

Show comment
Hide comment
@muratme

muratme Dec 5, 2016

any update about this issue?

muratme commented Dec 5, 2016

any update about this issue?

@prahlad06

This comment has been minimized.

Show comment
Hide comment
@prahlad06

prahlad06 Dec 6, 2016

Hi all,

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

prahlad06 commented Dec 6, 2016

Hi all,

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

@marekcirkos

This comment has been minimized.

Show comment
Hide comment
@marekcirkos

marekcirkos Dec 6, 2016

Contributor

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

Contributor

marekcirkos commented Dec 6, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Dec 6, 2016

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);
}
Contributor

mykola-mokhnach commented Dec 6, 2016

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

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Dec 6, 2016

Contributor

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

Contributor

mykola-mokhnach commented Dec 6, 2016

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

@toejough

This comment has been minimized.

Show comment
Hide comment
@toejough

toejough Dec 6, 2016

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

toejough commented Dec 6, 2016

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

@marekcirkos

This comment has been minimized.

Show comment
Hide comment
@marekcirkos

marekcirkos Dec 7, 2016

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.

Contributor

marekcirkos commented Dec 7, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Dec 7, 2016

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+.

Contributor

mykola-mokhnach commented Dec 7, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Dec 7, 2016

Contributor

@toejough did the patch work for you?

Contributor

mykola-mokhnach commented Dec 7, 2016

@toejough did the patch work for you?

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Dec 7, 2016

Contributor

@marekcirkos I did a small investigation on visibility detection. Actually, I see two problematic areas now.
The first situation is when an element is outside the viewport, like
1
This can be potentially solved by analysing main window frame size and check whether it intersects with target element's frame, but XCTest also sometimes logs errors when I try to receive application property from a snapshot.

The second situation is the most tricky one:
2
The element here is just covered by another element. I have no idea about how to reliably detect visibility of such element properly, even having z-index property available.

Contributor

mykola-mokhnach commented Dec 7, 2016

@marekcirkos I did a small investigation on visibility detection. Actually, I see two problematic areas now.
The first situation is when an element is outside the viewport, like
1
This can be potentially solved by analysing main window frame size and check whether it intersects with target element's frame, but XCTest also sometimes logs errors when I try to receive application property from a snapshot.

The second situation is the most tricky one:
2
The element here is just covered by another element. I have no idea about how to reliably detect visibility of such element properly, even having z-index property available.

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Dec 7, 2016

Contributor

We might also rely on hittable option of XCUIElement class, but there is no such option for snapshots, which means we'll need to resolve the whole tree (or big part of it) to show visibility attribute value for /source command output or to generate an xml tree (since each node there also has visible attribute set), which is sloooow.

Contributor

mykola-mokhnach commented Dec 7, 2016

We might also rely on hittable option of XCUIElement class, but there is no such option for snapshots, which means we'll need to resolve the whole tree (or big part of it) to show visibility attribute value for /source command output or to generate an xml tree (since each node there also has visible attribute set), which is sloooow.

@Blinkk

This comment has been minimized.

Show comment
Hide comment
@Blinkk

Blinkk Dec 7, 2016

@mykola-mokhnach I am also having this issue with some additional strange behavior and I am a bit confused.

I am able to locate and interact with an element using a custom method in one area of the application I am testing, but am seeing some strange behavior using almost identical methods in other parts of the application. Here is the method that works:

public IWebElement GetMenuElement(int index)
{
    try
    {
        return driver.FindElement(By.XPath(
            string.Format("//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]" +
            "/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]" +
            "/XCUIElementTypeTable[1]/XCUIElementTypeCell[{0}]/XCUIElementTypeButton[1]", index)));
    }
    catch (Exception e)
    {
        Debug.WriteLine("Failed to GetMenuElement(" + index + ") in " + this.ToString());
        throw e;
    }
}

This selects a button from a small list of buttons within a hamburger menu and does so flawlessly. The following method attempts to do essentially the same thing (however, in a larger list of elements) and gets stuck in an loop of POST requests and eventually fails.

public IWebElement GetProductQuickCartElement(int index)
{
    try
    {
        return driver.FindElement(By.XPath(
            string.Format("//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]" +
            "/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]" +
            "/XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeCell[{0}]/XCUIElementTypeButton[1]", index)));
    }
    catch (Exception e)
    {
        Debug.WriteLine("Failed to GetProductQuickCartElement(" + index + ") in " + this.ToString());
        throw e;
    }
}

A full copy of the test logs can be seen here. Note that at line 496 it successfully uses the first method to locate an element.

Additionally, using the following method (almost identical to the other two, again) I receive an error:

public IWebElement GetMenuElement(int index)
{
    try
    {
        return driver.FindElement(By.XPath(
            string.Format("//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]" +
            "/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]" + 
            "/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeCell[{0}]", index)));
    }
    catch (Exception e)
    {
        Debug.WriteLine("Failed to GetMenuElement(" + index + ") in " + this.ToString());
        throw e;
    }
}

Error:
XCTRunner[1068]: Enqueue Failure: UI Testing Failure - Failure fetching attributes for element <XCAccessibilityElement: 0x608000248a30> Device element: Error Domain=XCTestManagerErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} <unknown> 0 1
Full log here.

I have tried using the workarounds mentioned in this thread (the patch mentioned by @mykola-mokhnach) and got this:

  • The logs for the test that threw the "UI Testing Failure" error shows this
  • The test that was looping POST requests shows the same behavior.

I would appreciate any help anyone may be able to offer in this area because while I have ways of working around this by getting the entire list of elements in a List<> by using "ClassName" attribute and selecting one by index, this is incredibly slow as some of the lists of elements I am working with can be very large. These custom methods speed up my tests significantly (which is why I created them) and I would like to be able to continue using them.

Blinkk commented Dec 7, 2016

@mykola-mokhnach I am also having this issue with some additional strange behavior and I am a bit confused.

I am able to locate and interact with an element using a custom method in one area of the application I am testing, but am seeing some strange behavior using almost identical methods in other parts of the application. Here is the method that works:

public IWebElement GetMenuElement(int index)
{
    try
    {
        return driver.FindElement(By.XPath(
            string.Format("//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]" +
            "/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]" +
            "/XCUIElementTypeTable[1]/XCUIElementTypeCell[{0}]/XCUIElementTypeButton[1]", index)));
    }
    catch (Exception e)
    {
        Debug.WriteLine("Failed to GetMenuElement(" + index + ") in " + this.ToString());
        throw e;
    }
}

This selects a button from a small list of buttons within a hamburger menu and does so flawlessly. The following method attempts to do essentially the same thing (however, in a larger list of elements) and gets stuck in an loop of POST requests and eventually fails.

public IWebElement GetProductQuickCartElement(int index)
{
    try
    {
        return driver.FindElement(By.XPath(
            string.Format("//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]" +
            "/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]" +
            "/XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeCell[{0}]/XCUIElementTypeButton[1]", index)));
    }
    catch (Exception e)
    {
        Debug.WriteLine("Failed to GetProductQuickCartElement(" + index + ") in " + this.ToString());
        throw e;
    }
}

A full copy of the test logs can be seen here. Note that at line 496 it successfully uses the first method to locate an element.

Additionally, using the following method (almost identical to the other two, again) I receive an error:

public IWebElement GetMenuElement(int index)
{
    try
    {
        return driver.FindElement(By.XPath(
            string.Format("//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]" +
            "/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]" + 
            "/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeCell[{0}]", index)));
    }
    catch (Exception e)
    {
        Debug.WriteLine("Failed to GetMenuElement(" + index + ") in " + this.ToString());
        throw e;
    }
}

Error:
XCTRunner[1068]: Enqueue Failure: UI Testing Failure - Failure fetching attributes for element <XCAccessibilityElement: 0x608000248a30> Device element: Error Domain=XCTestManagerErrorDomain Code=13 "Error copying attributes -25202" UserInfo={NSLocalizedDescription=Error copying attributes -25202} <unknown> 0 1
Full log here.

I have tried using the workarounds mentioned in this thread (the patch mentioned by @mykola-mokhnach) and got this:

  • The logs for the test that threw the "UI Testing Failure" error shows this
  • The test that was looping POST requests shows the same behavior.

I would appreciate any help anyone may be able to offer in this area because while I have ways of working around this by getting the entire list of elements in a List<> by using "ClassName" attribute and selecting one by index, this is incredibly slow as some of the lists of elements I am working with can be very large. These custom methods speed up my tests significantly (which is why I created them) and I would like to be able to continue using them.

@jediboy

This comment has been minimized.

Show comment
Hide comment
@jediboy

jediboy Dec 8, 2016

So for me, I've narrowed this issue down to table views that do paginated scrolling. We hit the server for the first 10 rows of data for the table and as you scroll down we hit the server to get the next 10 rows and so on until all of the rows have been retrieved.

From what I can tell, there seems to be some sort of automatic scrolling happening behind the scenes that is attempting to scroll the view to get all of the elements. The view in the app doesn't appear to be physically scrolling, but it is loading more elements. I know this because I can see the calls happening to the server and the appium inspector will eventually respond with hundreds of table cells even though I haven't physically done any scrolling in the app to retrieve the additional data rows. Until this auto scrolling process completes, appium appears to be "hung" and you can't find any other elements.

I'm not sure what I can do to get around this situation yet, but it's pretty consistent for me. Is there any way to stop this auto scrolling from happening? For the time being, I can add try/catches in my code with hard coded wait times, but that's a pretty poor way to do automated testing :/

jediboy commented Dec 8, 2016

So for me, I've narrowed this issue down to table views that do paginated scrolling. We hit the server for the first 10 rows of data for the table and as you scroll down we hit the server to get the next 10 rows and so on until all of the rows have been retrieved.

From what I can tell, there seems to be some sort of automatic scrolling happening behind the scenes that is attempting to scroll the view to get all of the elements. The view in the app doesn't appear to be physically scrolling, but it is loading more elements. I know this because I can see the calls happening to the server and the appium inspector will eventually respond with hundreds of table cells even though I haven't physically done any scrolling in the app to retrieve the additional data rows. Until this auto scrolling process completes, appium appears to be "hung" and you can't find any other elements.

I'm not sure what I can do to get around this situation yet, but it's pretty consistent for me. Is there any way to stop this auto scrolling from happening? For the time being, I can add try/catches in my code with hard coded wait times, but that's a pretty poor way to do automated testing :/

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Dec 8, 2016

Contributor

@jediboy I've prepared a PR, which allows to wait properly until an animation is finished to avoid hardcoded timeouts. You can try to apply that patch to your local codebase and check whether it solves the issue with your tests.

Contributor

mykola-mokhnach commented Dec 8, 2016

@jediboy I've prepared a PR, which allows to wait properly until an animation is finished to avoid hardcoded timeouts. You can try to apply that patch to your local codebase and check whether it solves the issue with your tests.

@jediboy

This comment has been minimized.

Show comment
Hide comment
@jediboy

jediboy Dec 8, 2016

Thanks @mykola-mokhnach .. assuming I applied the PR correctly, I'm still seeing that message in the log. Any idea why it's trying to do that auto scrolling of the view? My test is trying to tap on the first cell in the table but it's super slow because it loading every cell before it tries to tap the cell that I want.

jediboy commented Dec 8, 2016

Thanks @mykola-mokhnach .. assuming I applied the PR correctly, I'm still seeing that message in the log. Any idea why it's trying to do that auto scrolling of the view? My test is trying to tap on the first cell in the table but it's super slow because it loading every cell before it tries to tap the cell that I want.

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Dec 9, 2016

Contributor

@jediboy It's not just enough to apply it. You need to call this API before you do element lookup to make sure the animation is finished. It just allows to replace hardcoded sleeps with timed sleeps.

Regarding scrolling. WDA will try to automatically scroll to reach the destination cell if you try to click it and it is currently invisible. So try to scroll the view yourself first to make sure the destination cell is visible.

Contributor

mykola-mokhnach commented Dec 9, 2016

@jediboy It's not just enough to apply it. You need to call this API before you do element lookup to make sure the animation is finished. It just allows to replace hardcoded sleeps with timed sleeps.

Regarding scrolling. WDA will try to automatically scroll to reach the destination cell if you try to click it and it is currently invisible. So try to scroll the view yourself first to make sure the destination cell is visible.

@KBhatti

This comment has been minimized.

Show comment
Hide comment
@KBhatti

KBhatti Dec 10, 2016

@mykola-mokhnach what if the cell is currently visible but I still see this issue? Is that also something WDA is trying to come up with a fix for? Also, any ETA for that please?

KBhatti commented Dec 10, 2016

@mykola-mokhnach what if the cell is currently visible but I still see this issue? Is that also something WDA is trying to come up with a fix for? Also, any ETA for that please?

@marekcirkos

This comment has been minimized.

Show comment
Hide comment
@marekcirkos

marekcirkos Dec 10, 2016

Contributor

@KBhatti Less problematic visibility check is definitely what we want to achieve. However most likely it will take some time. As everything in OpenSource there is no ETA for this as people spend their private live time on this. Feel free to join discussion or pop some PRs, if you have some ideas.

Contributor

marekcirkos commented Dec 10, 2016

@KBhatti Less problematic visibility check is definitely what we want to achieve. However most likely it will take some time. As everything in OpenSource there is no ETA for this as people spend their private live time on this. Feel free to join discussion or pop some PRs, if you have some ideas.

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Mar 28, 2017

Contributor

7d2896e should fix the problem described in this issue.

Contributor

mykola-mokhnach commented Mar 28, 2017

7d2896e should fix the problem described in this issue.

@b1ueshad0w

This comment has been minimized.

Show comment
Hide comment
@b1ueshad0w

b1ueshad0w Apr 6, 2017

@marekcirkos I have tried 7d2896e but the error still exists.
With the backtrace, it's likely that self.hitPoint is the cause.
-[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
0 CoreFoundation 0x000000010c064b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010bac9141 objc_exception_throw + 48
2 CoreFoundation 0x000000010bf795cd -[__NSPlaceholderArray initWithObjects:count:] + 269
3 CoreFoundation 0x000000010bf80314 +[NSArray arrayWithObjects:count:] + 52
4 XCTest 0x000000010b4c54f7 -[XCElementSnapshot(Hitpoint) _transformPoint:windowContextID:windowDisplayID:] + 133
5 XCTest 0x000000010b4c58e9 -[XCElementSnapshot(Hitpoint) hitPoint] + 386
6 WebDriverAgentLib 0x000000011d85be4a -[XCElementSnapshot(FBIsVisible) fb_isVisible] + 810
7 WebDriverAgentLib 0x000000011d8674fb -[XCElementSnapshot(WebDriverAttributes) isWDVisible] + 43
8 WebDriverAgentLib 0x000000011d858714 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 1940
9 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
10 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
11 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
12 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
13 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
14 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
15 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
16 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
17 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
18 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
19 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
20 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
21 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
22 WebDriverAgentLib 0x000000011d857ebd -[XCUIApplication(FBHelpers) fb_tree] + 93
23 WebDriverAgentLib 0x000000011d868845 +[FBDebugCommands handleGetSourceCommand:] + 565
24 WebDriverAgentLib 0x000000011d85e683 -[FBRoute_TargetAction mountRequest:intoResponse:] + 179
25 WebDriverAgentLib 0x000000011d855404 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 548
26 RoutingHTTPServer 0x000000011d8f8c18 -[RoutingHTTPServer handleRoute:withRequest:response:] + 136
27 RoutingHTTPServer 0x000000011d8f94fa __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 47
28 libdispatch.dylib 0x000000010f1a3792 _dispatch_client_callout + 8
29 libdispatch.dylib 0x000000010f18c4e0 _dispatch_barrier_sync_f_slow_invoke + 292
30 libdispatch.dylib 0x000000010f1a3792 _dispatch_client_callout + 8
31 libdispatch.dylib 0x000000010f18b247 _dispatch_main_queue_callback_4CF + 1041
32 CoreFoundation 0x000000010c029909 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
33 CoreFoundation 0x000000010bfefae4 _CFRunLoopRun + 2164
34 CoreFoundation 0x000000010bfef016 CFRunLoopRunSpecific + 406
35 Foundation 0x000000010b5b2480 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
36 Foundation 0x000000010b5b235b -[NSRunLoop(NSRunLoop) run] + 76
37 WebDriverAgentLib 0x000000011d8543e3 -[FBWebServer startServing] + 211
38 WebDriverAgentRunner 0x000000011cfe0254 -[UITestingUITests testRunner] + 100
39 CoreFoundation 0x000000010bfecc6c invoking
+ 140
40 CoreFoundation 0x000000010bfecb40 -[NSInvocation invoke] + 320
41 XCTest 0x000000010b47d8e2 __24-[XCTestCase invokeTest]_block_invoke_2 + 491
42 XCTest 0x000000010b4bbf62 -[XCTestContext performInScope:] + 190
43 XCTest 0x000000010b47d6e4 -[XCTestCase invokeTest] + 254
44 XCTest 0x000000010b47dfb2 -[XCTestCase performTest:] + 565
45 XCTest 0x000000010b47b078 __27-[XCTestSuite performTest:]_block_invoke + 300
46 XCTest 0x000000010b47ac68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
47 XCTest 0x000000010b47ae4e -[XCTestSuite performTest:] + 214
48 XCTest 0x000000010b47b078 __27-[XCTestSuite performTest:]_block_invoke + 300
49 XCTest 0x000000010b47ac68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
50 XCTest 0x000000010b47ae4e -[XCTestSuite performTest:] + 214
51 XCTest 0x000000010b47b078 __27-[XCTestSuite performTest:]_block_invoke + 300
52 XCTest 0x000000010b47ac68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
53 XCTest 0x000000010b47ae4e -[XCTestSuite performTest:] + 214
54 XCTest 0x000000010b4c7a86 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
55 XCTest 0x000000010b489f27 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 574
56 XCTest 0x000000010b4c7925 -[XCTTestRunSession runTestsAndReturnError:] + 281
57 XCTest 0x000000010b465a50 -[XCTestDriver runTestsAndReturnError:] + 254
58 XCTest 0x000000010b4bf86e _XCTestMain + 559
59 CoreFoundation 0x000000010c00ab5c CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12
60 CoreFoundation 0x000000010bfefe54 __CFRunLoopDoBlocks + 356
61 CoreFoundation 0x000000010bfef5ee __CFRunLoopRun + 894
62 CoreFoundation 0x000000010bfef016 CFRunLoopRunSpecific + 406
63 GraphicsServices 0x000000010e4b7a24 GSEventRunModal + 62
64 UIKit 0x000000010c4880d4 UIApplicationMain + 159
65 XCTRunner 0x000000010b3d588b XCTRunner + 6283
66 libdyld.dylib 0x000000010f1ec65d start + 1

b1ueshad0w commented Apr 6, 2017

@marekcirkos I have tried 7d2896e but the error still exists.
With the backtrace, it's likely that self.hitPoint is the cause.
-[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
0 CoreFoundation 0x000000010c064b0b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010bac9141 objc_exception_throw + 48
2 CoreFoundation 0x000000010bf795cd -[__NSPlaceholderArray initWithObjects:count:] + 269
3 CoreFoundation 0x000000010bf80314 +[NSArray arrayWithObjects:count:] + 52
4 XCTest 0x000000010b4c54f7 -[XCElementSnapshot(Hitpoint) _transformPoint:windowContextID:windowDisplayID:] + 133
5 XCTest 0x000000010b4c58e9 -[XCElementSnapshot(Hitpoint) hitPoint] + 386
6 WebDriverAgentLib 0x000000011d85be4a -[XCElementSnapshot(FBIsVisible) fb_isVisible] + 810
7 WebDriverAgentLib 0x000000011d8674fb -[XCElementSnapshot(WebDriverAttributes) isWDVisible] + 43
8 WebDriverAgentLib 0x000000011d858714 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 1940
9 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
10 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
11 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
12 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
13 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
14 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
15 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
16 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
17 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
18 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
19 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
20 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
21 WebDriverAgentLib 0x000000011d8589e4 +[XCUIApplication(FBHelpers) dictionaryForElement:] + 2660
22 WebDriverAgentLib 0x000000011d857ebd -[XCUIApplication(FBHelpers) fb_tree] + 93
23 WebDriverAgentLib 0x000000011d868845 +[FBDebugCommands handleGetSourceCommand:] + 565
24 WebDriverAgentLib 0x000000011d85e683 -[FBRoute_TargetAction mountRequest:intoResponse:] + 179
25 WebDriverAgentLib 0x000000011d855404 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 548
26 RoutingHTTPServer 0x000000011d8f8c18 -[RoutingHTTPServer handleRoute:withRequest:response:] + 136
27 RoutingHTTPServer 0x000000011d8f94fa __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 47
28 libdispatch.dylib 0x000000010f1a3792 _dispatch_client_callout + 8
29 libdispatch.dylib 0x000000010f18c4e0 _dispatch_barrier_sync_f_slow_invoke + 292
30 libdispatch.dylib 0x000000010f1a3792 _dispatch_client_callout + 8
31 libdispatch.dylib 0x000000010f18b247 _dispatch_main_queue_callback_4CF + 1041
32 CoreFoundation 0x000000010c029909 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
33 CoreFoundation 0x000000010bfefae4 _CFRunLoopRun + 2164
34 CoreFoundation 0x000000010bfef016 CFRunLoopRunSpecific + 406
35 Foundation 0x000000010b5b2480 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
36 Foundation 0x000000010b5b235b -[NSRunLoop(NSRunLoop) run] + 76
37 WebDriverAgentLib 0x000000011d8543e3 -[FBWebServer startServing] + 211
38 WebDriverAgentRunner 0x000000011cfe0254 -[UITestingUITests testRunner] + 100
39 CoreFoundation 0x000000010bfecc6c invoking
+ 140
40 CoreFoundation 0x000000010bfecb40 -[NSInvocation invoke] + 320
41 XCTest 0x000000010b47d8e2 __24-[XCTestCase invokeTest]_block_invoke_2 + 491
42 XCTest 0x000000010b4bbf62 -[XCTestContext performInScope:] + 190
43 XCTest 0x000000010b47d6e4 -[XCTestCase invokeTest] + 254
44 XCTest 0x000000010b47dfb2 -[XCTestCase performTest:] + 565
45 XCTest 0x000000010b47b078 __27-[XCTestSuite performTest:]_block_invoke + 300
46 XCTest 0x000000010b47ac68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
47 XCTest 0x000000010b47ae4e -[XCTestSuite performTest:] + 214
48 XCTest 0x000000010b47b078 __27-[XCTestSuite performTest:]_block_invoke + 300
49 XCTest 0x000000010b47ac68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
50 XCTest 0x000000010b47ae4e -[XCTestSuite performTest:] + 214
51 XCTest 0x000000010b47b078 __27-[XCTestSuite performTest:]_block_invoke + 300
52 XCTest 0x000000010b47ac68 -[XCTestSuite _performProtectedSectionForTest:testSection:] + 29
53 XCTest 0x000000010b47ae4e -[XCTestSuite performTest:] + 214
54 XCTest 0x000000010b4c7a86 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 40
55 XCTest 0x000000010b489f27 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 574
56 XCTest 0x000000010b4c7925 -[XCTTestRunSession runTestsAndReturnError:] + 281
57 XCTest 0x000000010b465a50 -[XCTestDriver runTestsAndReturnError:] + 254
58 XCTest 0x000000010b4bf86e _XCTestMain + 559
59 CoreFoundation 0x000000010c00ab5c CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12
60 CoreFoundation 0x000000010bfefe54 __CFRunLoopDoBlocks + 356
61 CoreFoundation 0x000000010bfef5ee __CFRunLoopRun + 894
62 CoreFoundation 0x000000010bfef016 CFRunLoopRunSpecific + 406
63 GraphicsServices 0x000000010e4b7a24 GSEventRunModal + 62
64 UIKit 0x000000010c4880d4 UIApplicationMain + 159
65 XCTRunner 0x000000010b3d588b XCTRunner + 6283
66 libdyld.dylib 0x000000010f1ec65d start + 1

@KBhatti

This comment has been minimized.

Show comment
Hide comment
@KBhatti

KBhatti Apr 7, 2017

@mykola-mokhnach so it works on my local machine after making your latest change. But if my tests are running somewhere else not local (like SauceLabs etc.) using appium 1.6.4 how do I incorporate the change in that cas?
@marekcirkos

KBhatti commented Apr 7, 2017

@mykola-mokhnach so it works on my local machine after making your latest change. But if my tests are running somewhere else not local (like SauceLabs etc.) using appium 1.6.4 how do I incorporate the change in that cas?
@marekcirkos

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Apr 7, 2017

Contributor

@KBhatti these changes have been already incorporated into Appium 1.6.4-beta

Contributor

mykola-mokhnach commented Apr 7, 2017

@KBhatti these changes have been already incorporated into Appium 1.6.4-beta

b1ueshad0w added a commit to b1ueshad0w/WebDriverAgent that referenced this issue Apr 7, 2017

@marekcirkos

This comment has been minimized.

Show comment
Hide comment
@marekcirkos

marekcirkos Apr 7, 2017

Contributor

Did fa1a7c5 help with this issue? cc @mykola-mokhnach

Contributor

marekcirkos commented Apr 7, 2017

Did fa1a7c5 help with this issue? cc @mykola-mokhnach

@KBhatti

This comment has been minimized.

Show comment
Hide comment
@KBhatti

KBhatti Apr 8, 2017

@mykola-mokhnach I just got 1.6.4 installed today and most of the stuff works except one of these screens (am attaching the screenshot). The darkgray portion on the top-end of the screen - if we scroll it expands or contracts accordingly. If I need to validate or click on some acceibility ID from that portion it errors out (not being able to identify within 10 seconds)
screen shot 2017-04-07 at 5 06 05 pm

KBhatti commented Apr 8, 2017

@mykola-mokhnach I just got 1.6.4 installed today and most of the stuff works except one of these screens (am attaching the screenshot). The darkgray portion on the top-end of the screen - if we scroll it expands or contracts accordingly. If I need to validate or click on some acceibility ID from that portion it errors out (not being able to identify within 10 seconds)
screen shot 2017-04-07 at 5 06 05 pm

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Apr 8, 2017

Contributor

@KBhatti Your issue has nothing to to with the current topic. Please ask questions in Appium forum instead.

Contributor

mykola-mokhnach commented Apr 8, 2017

@KBhatti Your issue has nothing to to with the current topic. Please ask questions in Appium forum instead.

@KBhatti

This comment has been minimized.

Show comment
Hide comment
@KBhatti

KBhatti Apr 15, 2017

@mykola-mokhnach my issue is actually very much related to this post. The message with the screenshot that I posted in my last post is an issue that I am facing AFTER installing Appium 1.6.4.

The irony is that the same test was working when I was using this previous fix of yours: @implementation XCElementSnapshot (FBIsVisible)

  • (BOOL)fb_isVisible
    {
    return !CGRectIsEmpty(self.frame) && !CGRectIsEmpty(self.visibleFrame) && (CGRectIntersectsRect(self.visibleFrame, self.application.frame) || ((self.application.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.application.interfaceOrientation == UIInterfaceOrientationLandscapeRight) && self.application.frame.size.height > self.application.frame.size.width && CGRectIntersectsRect(self.visibleFrame, CGRectMake(0, 0, self.application.frame.size.height, self.application.frame.size.width))));
    }
    @EnD

KBhatti commented Apr 15, 2017

@mykola-mokhnach my issue is actually very much related to this post. The message with the screenshot that I posted in my last post is an issue that I am facing AFTER installing Appium 1.6.4.

The irony is that the same test was working when I was using this previous fix of yours: @implementation XCElementSnapshot (FBIsVisible)

  • (BOOL)fb_isVisible
    {
    return !CGRectIsEmpty(self.frame) && !CGRectIsEmpty(self.visibleFrame) && (CGRectIntersectsRect(self.visibleFrame, self.application.frame) || ((self.application.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.application.interfaceOrientation == UIInterfaceOrientationLandscapeRight) && self.application.frame.size.height > self.application.frame.size.width && CGRectIntersectsRect(self.visibleFrame, CGRectMake(0, 0, self.application.frame.size.height, self.application.frame.size.width))));
    }
    @EnD
@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Apr 15, 2017

Contributor

@KBhatti is your problem related to #542?

Contributor

mykola-mokhnach commented Apr 15, 2017

@KBhatti is your problem related to #542?

@Nischalapp

This comment has been minimized.

Show comment
Hide comment
@Nischalapp

Nischalapp Apr 15, 2017

Nischalapp commented Apr 15, 2017

@KBhatti

This comment has been minimized.

Show comment
Hide comment
@KBhatti

KBhatti Apr 17, 2017

@mykola-mokhnach maybe I was not clear enough explaining my issue..so I'll put it in steps

  1. The issue I posted above was initially not working with 1.6.3
  2. I then applied the fix you had suggested (I believe you came up with this fix about a couple months ago), and it then started working so thats good.
  3. I updated my Appium to 1.6.4 on 04/07/2017 and now this issue started recurring
  4. I again changed the code in the FBIsVisible file to your original fix from 2-3 months ago and then it works again as expected

So, some of the things may have been fixed with 1.6.4 but in this particular case, the older fix works, but not the 7d2896e. Hopefully that explains it better..please let me know if there is still confusion.

KBhatti commented Apr 17, 2017

@mykola-mokhnach maybe I was not clear enough explaining my issue..so I'll put it in steps

  1. The issue I posted above was initially not working with 1.6.3
  2. I then applied the fix you had suggested (I believe you came up with this fix about a couple months ago), and it then started working so thats good.
  3. I updated my Appium to 1.6.4 on 04/07/2017 and now this issue started recurring
  4. I again changed the code in the FBIsVisible file to your original fix from 2-3 months ago and then it works again as expected

So, some of the things may have been fixed with 1.6.4 but in this particular case, the older fix works, but not the 7d2896e. Hopefully that explains it better..please let me know if there is still confusion.

@marekcirkos

This comment has been minimized.

Show comment
Hide comment
@marekcirkos

marekcirkos Apr 18, 2017

Contributor

Just discovered that we are still having some issues with visibility check :/.

Contributor

marekcirkos commented Apr 18, 2017

Just discovered that we are still having some issues with visibility check :/.

@KBhatti

This comment has been minimized.

Show comment
Hide comment
@KBhatti

KBhatti 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]"

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

This comment has been minimized.

Show comment
Hide comment
@fancychimp

fancychimp 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.

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

This comment has been minimized.

Show comment
Hide comment
@marekcirkos

marekcirkos Jul 24, 2017

Contributor

How is stuff now? Can we consider it fixed?

Contributor

marekcirkos commented Jul 24, 2017

How is stuff now? Can we consider it fixed?

@toejough

This comment has been minimized.

Show comment
Hide comment
@toejough

toejough 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.

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

This comment has been minimized.

Show comment
Hide comment
@vmaxim

vmaxim Aug 4, 2017

@marekcirkos

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

logs

vmaxim commented Aug 4, 2017

@marekcirkos

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

logs

@fancychimp

This comment has been minimized.

Show comment
Hide comment
@fancychimp

fancychimp Sep 19, 2017

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

fancychimp commented Sep 19, 2017

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

This comment has been minimized.

Show comment
Hide comment
@Dheepthi

Dheepthi 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

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

@pluie-cloud

This comment has been minimized.

Show comment
Hide comment
@pluie-cloud

pluie-cloud 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}}

pluie-cloud 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

This comment has been minimized.

Show comment
Hide comment
@shynkevich-alex

shynkevich-alex Nov 22, 2017

  • 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

shynkevich-alex commented Nov 22, 2017

  • 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

This comment has been minimized.

Show comment
Hide comment
@SamyQAZ

SamyQAZ 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?

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

This comment has been minimized.

Show comment
Hide comment
@tfcardoso

tfcardoso Mar 9, 2018

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

tfcardoso commented Mar 9, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment