In web page i have n number of links ie the links displayed are random there may be one link or there be five links.I have written code in way that it will open first link in a new tab and do some function.The problem is i don't how to do the same if there are more links . is it possible to iterate or any other way to handle this
Changerequest is the link that is present in the webpage
Sourcecontrol = driver.find_element_by_xpath('//li[@class="menu-item"]/a[contains(.,"Source Control")]')
Sourcecontrol.click();
Changerequest=driver.find_element_by_xpath( '//td[@class="confluenceTd"]/a[contains(.,"Change: ")]');
testvalue = Changerequest.get_attribute('href')
driver.execute_script("window.open(arguments[0])",testvalue)
window_after = driver.window_handles[1]
driver.switch_to_window(window_after)
sample HTML of the links
<div class="flooded">
<div class="table-wrap">
<table class="confluenceTable"><tbody>
<tr>
<td class="confluenceTd"><a href="link" class="external-link" rel="nofollow" title="Follow link">Change: 1111</a></td>
<td class="confluenceTd">date</td>
</tr>
<tr>
<td class="confluenceTd"><a href="Link" rel="nofollow" title="Follow link">Change: 2222</a></td>
<td class="confluenceTd">date</td>
</tr>
<tr>
<td class="confluenceTd"><a href="link" class="external-link" rel="nofollow" title="Follow link">Change: 33333</a></td>
<td class="confluenceTd">date</td>
</tr>
<tr>
<td class="confluenceTd"><a href="link" class="external-link" rel="nofollow" title="Follow link">Change: 44444</a></td>
<td class="confluenceTd">date</td>
</tr>
</tbody></table>
</div>
</div>