After loading a webpage, I need to click a 'next' button. I use the xpath to wait for it to become visible, then click it:
.waitForElementVisible('//*[@class="client-action-button"][.="next"]', config.timeout)
.click('//*[@class="client-action-button"][.="next"]');
This gives an output 'Warn: WaitForElement found 3 elements for selector "//*[@class="client-action-button"][.="next"]". Only the first one will be checked.'
However the first element is never visible, the second or third element is. Is there any way to wait for the visible element and then click it?
I could try selecting the nth element, eg using the xPath:
(//*[@class="client-action-button"][.="next"])[2]
However I would like to avoid this.
Thanks, Craig.