Greetings for taking the time to review my query. In examining a webpage, I have come across more than 200 links and have verified that they are all functioning properly. The challenge arises when extracting the 'href' value as it does not always contain an actual link but rather a JavaScript function being called. Here is an example source:
<a tabindex="8" title="Internal Crossload" target="_self" href="javascript:fnnHomePage('3' , 'WTMS_EXPRESS')"> - Internal Crossload </a>
One of the JavaScript functions being invoked is as follows:
<Script>
/*********************************************************************
Function Name : fnnHomePage
Input Parameter(s) : transferTypeId
Output Parameter(s) : None
**********************************************************************/
function fnnHomePage(transferTypeId ,moduleName) {
if (moduleName == "XXX_EXPRESS")
{
document.getElementById("transferTypeId").value=transferTypeId;
document.getElementById("gadgetType").value="XXX_EXPRESS";
document.getElementById("moduleName").value="XXX_EXPRESS";
document.forms[0].action="/XXX/getProposalHomePage.do?transferTypeId="+transferTypeId;
document.forms[0].submit();
}
if (moduleName == "CROSSLOAD")
{
document.getElementById("transferTypeId").value=transferTypeId;
document.getElementById("gadgetType").value="CROSSLOAD";
document.getElementById("moduleName").value="CROSSLOAD";
document.forms[0].action="/XXX/getCrossLoadHomePage.do?transferTypeId="+transferTypeId;
document.forms[0].submit();
}
}
</Script>
Given this scenario, how can I extract a valid 'Link' and verify its functionality using Selenium WebDriver, considering each link triggers a different 'JavaScript function'? Any insights or recommendations on this matter would be highly valued. Thank you.