UI Automation "failed because item is not displayed" iOS

It drives me crazy if anyone can help, I would really appreciate it ... I am trying to write a ui script automation to test the application. There is a specific view of the collection in which cells are generated from the tip, the view first loaded ....

- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.title = @"Forms"; [self.categoryCollectionView registerNib:[UINib nibWithNibName:@"HomeCategoryCell" bundle:nil] forCellWithReuseIdentifier:@"HomeCategoryCell"]; [self.formsCollectionView registerNib:[UINib nibWithNibName:@"HomeFormCell" bundle:nil] forCellWithReuseIdentifier:@"HomeFormCell"]; [self.existingFormsCollectionView registerNib:[UINib nibWithNibName:@"HomeExistingFormCell" bundle:nil] forCellWithReuseIdentifier:@"HomeExistingFormCell"]; [self setupFormCategories]; } 

And then the installation form method ...

 - (void)setupFormCategories { categories = [[NSMutableArray alloc] init]; FormCategory *cat = [[FormCategory alloc] init]; cat.categoryTitle = @"All Forms"; cat.iconFileName = @"CategoryIcon.png"; cat.relatedForms = @[@"Form Type 1", @"Form Type 2"]; [categories addObject:cat]; cat = [[FormCategory alloc] init]; cat.categoryTitle = @"Customer Forms"; cat.iconFileName = @"CategoryIcon.png"; cat.relatedForms = @[@"Form Type 1", @"Form Type 2"]; [categories addObject:cat]; cat = [[FormCategory alloc] init]; cat.categoryTitle = @"Client Forms"; cat.iconFileName = @"CategoryIcon.png"; cat.relatedForms = @[@"Form Type 1", @"Form Type 2"]; [categories addObject:cat]; cat = [[FormCategory alloc] init]; cat.categoryTitle = @"User Forms"; cat.iconFileName = @"CategoryIcon.png"; cat.relatedForms = @[@"Form Type 1", @"Form Type 2"]; [categories addObject:cat]; brandNewForms = nil; } 

I tried several ways to select one of these forms (both categoryTitle and their associated forms ...

 target.frontMostApp().mainWindow().collectionViews()[0].cells()["User Forms"].tap(); 

Just like firstWithPredicate etc. However, I always get the same answer ....

Script threw an unauthorized JavaScript error: target.frontMostApp (). mainWindow (). collectionViews () [0] .cells () ["Custom Forms"] cannot be enabled because the item does not appear on line 64 of wip.js

If I register a tree of elements, it can see all types of elements and returns a complete tree of elements. If I register user interaction using tools, it will recognize the elements and will generate this javascript ...

 target.frontMostApp().mainWindow().collectionViews()[0].cells()["User Forms"].tap(); 

No matter what I do, I cannot get it to work. I tried to change the accessibility settings using the interface constructor, ensuring that the view it is on does not have a set of accessibility features, however I cannot get it to work. I also cannot understand why it recognizes elements in logElementTree and writes, but not at startup ...

Any ideas ... Any suggestions, how can I change the objective C code if this is a problem ...? I tried playing with cat.accessibilityLabel = @ "Custom Forms"; but I am new to C lens and I don’t know what I am doing ....

xCode 5 / iOS7 simulator ... but I also tried in xCode 4.6.3 / iOS6.1 ....

+4
source share
1 answer

From your description of the problem, it looks like the cell you want to click is in the hierarchy of views, but it is literally just not visible on the screen.

You might need to scroll first to make it visible. Also, it looks like you have different categories of items. You may need to select the desired category in your application before this cell is visible.

0
source

All Articles