I am working on a wizard page that consists of multiple steps. Each step is shown based on the value of the "step" scope variable:
<div ng-show="step == 'first'">
<button>Next</button>
</div>
<div ng-show="step == 'second'">
<button>Next</button>
</div>
<div ng-show="step == 'third'">
<button>Next</button>
</div>
However, I am facing issues when trying to click the next button as there are three buttons with the same text. When using the following code:
var next = element(by.buttonText('Next'));
All three buttons are identified by this code. How can I locate and click only the visible button?