I have this HTML code:
<caption>
<em id="qwerty"> ABC </em>
</caption>
<caption>
<em id="qwerty"> 123 </em>
</caption>
How can I make a program in Python with Selenium Webdriver that finds the second element with id="qwerty"?
You can use find_elements_by_id() and take the second element (indexing in python starts from 0):
element = driver.find_elements_by_id('qwerty')[1]
idattribute on one page is a defect.