I need to traverse to another page for which I need to click on an anchor tag. On click of which the JS method gets executed and returns the page URL. However when make us of the following code the result is null. when I try to use the standard click() function I get Null.Snippet:
JS Function:
{code}
<script language="javascript">
function doSubmit(QS)
{
var strLink ="https://www.hudhomestore.com/pages/FilterBlank.aspx?caseNumber=" + QS + "&redir=PropertySummary&sLanguage=ENGLISH&zipCode=&city=&county=&sState=AK&fromPrice=0&toPrice=0&fCaseNumber=&bed=0&bath=0&street=&buyerType=0&specialProgram=&Status=0&OrderbyName=SCASENUMBER&OrderbyValue=ASC&sPageSize=10&pageId=1"
top.location.href = strLink;
}
{code}
Java Code:
{code}
if(anchor1.getTagName().equals("a"))
{
String js = anchor1.getAttribute("onClick");
System.out.println("Anchor is " + js);
ScriptResult result = page1.executeJavaScript("javascript:" + anchor1.getAttribute("onClick"));
if(result != null)
{
System.out.println("Result Aint Null" + result.toString());
Object jsResult = result.getJavaScriptResult();
if(jsResult != null)
{
System.out.println("Result: " + jsResult);
}
}
}
{/code}
Please help me.
Regards
Nitin