Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

My path has links whose text is changing

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
How can I click it?
One solution to this problem is to create a Javascript node in your path at the point where the link appears:

1) Right-click the node in the path that loads the page with the link you want to click and choose "Add javascript test"
2) In the window that pops up, click "New"
3) Make sure sure your target container is correct (if you have multiple frames or windows open at that point in the path). It will default to "Window: anonymous." If this is not the container with the link, change this value.
4) Enter code like the following:

CODE
// get the page's links
pageLinks = document.links;
index = 0;
found = false;

// iterate the links, looking for a special href value
// and click the link when we find it
while (index < pageLinks.length && !found) {
 link = pageLinks[index];
 href = new String(link.href);
 founda = (href.indexOf("somethingUniqueAboutTheHref") >= 0);
 if (found) {
   link.click();
 }
 ++index;
}

What this code does is grab all the links of the current page, search for a link whose 'href' includes 'somethingUniqueAboutTheHref' and clicks it. In this case, you want to change 'somethingUniqueAboutTheHref' to a unique value that is found only in the dynamically changing links.