So I have a custom UITextField that also has a floating label (using JVFloatLabeledTextField) that is in a custom view. In my custom view class I set the accessibility element to the JVFloatLabelTextField like so
CustomView.h
self.textField.isAccessibilityElement = YES;
self.textField.floatingLabel.isAccessibilityElement = YES;
// CGRect textFieldFrame = self.textField.frame - self.textField.floatingLabel.frame;
CGRect textFieldFrame = CGRectMake(0, self.textField.floatingLabel.frame.size.height, self.textField.frame.size.width, self.textField.frame.size.height - self.textField.floatingLabel.frame.size.height);
textFieldElement.accessibilityFrame = [self convertRect:textFieldFrame toView:nil];
textFieldElement.accessibilityIdentifier = @"TextField";
textFieldElement.accessibilityLabel = @"text field";
[self.accessibleElements addObject:textFieldElement];
This element does NOT exist
XCUIElement *textFieldElement = [[scrollViewQuery.otherElements matchingIdentifier:@"CustomView"] containingType:XCUIElementTypeTextField identifier:@"TextField"].element;
But this DOES exist:
XCUIElement *textFieldName = [scrollViewQuery.otherElements matchingIdentifier:@"CustomView"].otherElements[@"TextField"];
Does anyone know how I can get it to recognize the textfield as of XCUIElement type textfield??? Thank you!