How to access back bar button item in universal way under UITests in Xcode?
<p>The problem is when I try to access back bar button item because it is presented with:</p>
<ul>
<li><code>Restaurants</code> title,</li>
<li><code>Back</code> title</li>
<li><strong>without</strong> title</li>
</ul>
<p>Like it is on the screens:</p>
<p><a href="https://i.stack.imgur.com/n1l3x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n1l3x.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/reajE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/reajE.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/HmA6i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HmA6i.png" alt="enter image description here" /></a></p>
<p>Currently I access it like this:</p>
<pre><code>let backButton = XCUIApplication().buttons[&quot;Restaurants&quot;]
</code></pre>
<p>but it won't work for other cases. It is not universal way. May I somehow set it accessibilityIdentifier or something else?</p>