I am writing a test that fails with following error:
Error Domain=com.google.earlgrey.ElementInteractionErrorDomain Code=0 "No element found." UserInfo={NSLocalizedDescription=No element found.}
I can see in the generated screenshot that the element I am trying to match exists. I stepped through the code and saw that earlgrey uses element providers. When my test failed, I saw a ui hierarchy dump. I want to print the exact same ui hierarchy at specific breakpoints instead. How can I do that?
You can use the GREYElementHierarchy
class to print the element hierarchy at any point in your EarlGrey
test.
UIWindow *hierarchy = [[[UIApplication sharedApplication] delegate] window]);
NSLog(@"Hierarchy: %@", hierarchy);