Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access UITabBarItem from within UITests?

Within User Defined Runtime Attributes I set accessibilityIdentifier's value as browseTabBarButton.

But when I try to access this from UITests using:

app.tabBars.buttons["browseTabBarButton"]

UITabBarItem is not recognized. Why?

like image 526
Bartłomiej Semańczyk Avatar asked Mar 02 '16 12:03

Bartłomiej Semańczyk


1 Answers

If you are trying to access the UITabBarItem to switch tabs, you can achieve this in a different way by accessing the buttons within the UITabBar:

app.tabBars.firstMatch.buttons.element(boundBy: 0).tap()

like image 60
rhmac25 Avatar answered Oct 26 '22 22:10

rhmac25