Two buttons match. How do you pick the second one?
QuizMediumAsked in: Accenture, Capgemini, Wipro
The page has <div><button class="add">First</button></div><div><button class="add">Second</button></div>. Which XPath finds the button with the text Second?
(//button[@class='add'])[2]//button[@class='add'][2]//button[@class='add'][1]//button[@class='add' and position()=2]
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.