We only support landscape mode and for some reason when we would push to a different view controller, rotate the app, then pop, our UISearchBar would then take up the entire navigationBar and pushing even the title to the LHS. So we ended up wrapping the UISearchBar in a UIToolbar and that seemed to fix the issue.
So on the second view controller that gets pushed onto the stack, we have a UISearchbar in a UIToolbar in a UINavigationBar. I can't seem to access it. I wanted to write a script to enter some search items and click on those items so when our data model changes, we don't get crashes.
The problem I am having is I'm not sure how to access it. I am assuming that
UIATarget.localTarget().frontMostApp().mainWindow()
can be used on screens that aren't just the rootViewController. So I try to do
UIATarget.localTarget().frontMostApp().mainWindow().navigationBar().toolBar().tap();
But that dow not work. I am assuming navigationBar().buttons()[---] would not provide any use either since it's not a button I'm trying to access. When I do
window.logElementTree();
I see:
UIAWindow
-> UIANavigationBar
-> -> UIAButton
-> -> UIAToolbar // (I'm trying to show the disclosure triangles in how it looks like in the log.
So I can see the navigationBar I need, and the toolBar underneath it, but not sure how to get to it.
I also tried this
var navBarElements = window.navigationBar().elements();
for (var elem in navBarElements) {
if (elem["Toolbar"]) {
UIALogger.logMessage("toolbar");
}
}
In my code's viewDidLoad when I create the toolbar, I have this:
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 160, 44)];
toolbar.accessibilityIdentifier = @"Toolbar";
But I never get the logMessage indicating that I have the right item. Am I stuck trying to just use the screen and tapping on it? Thanks!