I'm in need of assistance with conducting an investigation and making improvements.
My objective is to collect all the <a>
tags containing the text Annual Report as part of their content, and then iterate through them as they are originally located within a table (2nd column per row
).
Here is the outline of the steps I plan to follow:
- Click on each
<a>
tag to open a new window - Extract specific values from the newly opened window
- Close the window
- Proceed to the next element (
<a>
tag) and repeat the process
The code snippet below represents my current attempt, however, it does not seem to be functioning properly. I am facing difficulties with clicking on the initial element.
var reportLinks = driver.findElements(By.partialLinkText('Annual Report'));
for(var i = 0; i < reportLinks.length; i++){
reportLinks[i].click();
}