Jump to content
nobounds

Javascript button with no ID#

Recommended Posts

nobounds

Trying to click on a Java button but it has no ID  , The menu I'm trying to click on is named "r.2". Standard scripts do not seem to work without a ID.

 

Partial source code from Java script

 <div class=sbmenu OnMouseOver="dOver(this);" OnMouseOut="dOut(this);" id="r" parentmenu="GMS">
<table cellspacing=0>
<tr menuname="r.1" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*SSE','SSE');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>SSE</b><br>Serial Number Eligibility</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.2" onclick="modclk(this,'WEB.CLAIMS','O*CLAIMS','CLAIMS');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>CLAIMS</b><br>Warranty Claim Entry</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.3" onclick="modclk(this,'WEB.CLAIMS','O*CLAIM.RPT.WEB','CLAIM.RPT.WEB');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>CLAIM.RPT.WEB</b><br>Warranty Claim Report</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.4" onclick="modclk(this,'WEB.CLAIMS','CSOP*CLAIM.APP','CLAIM.APP');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>CLAIM.APP</b><br>Claims Paid and Application Breakdown</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>

 

Regards,

 

Share this post


Link to post
Share on other sites
Danp2

Have you looked into using _IETagNameGetCollection? You would get a collection of TR elements and then process them one by one until you find the desired one. Search the forum for examples of doing this with other element types.

You could also take a look at this function to retrieve the element using xpath.

Share this post


Link to post
Share on other sites
nobounds

Trying this but can't seem to make it work.

Local $onClicks = _IETagNameGetCollection($oIE, "tr")
For $onClick In $onClicks
    If $onClick.classname == "r.2" Then _IEAction($onClick, "click")
Next

Here's part of the webpage source code.

 <div class=sbmenu OnMouseOver="dOver(this);" OnMouseOut="dOut(this);" id="r" parentmenu="GMS">
<table cellspacing=0>
<tr menuname="r.1" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*SSE','SSE');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>SSE</b><br>Serial Number Eligibility</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.2" onclick="modclk(this,'WEB.CLAIMS','O*CLAIMS','CLAIMS');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>CLAIMS</b><br>Warranty Claim Entry</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.3" onclick="modclk(this,'WEB.CLAIMS','O*CLAIM.RPT.WEB','CLAIM.RPT.WEB');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>CLAIM.RPT.WEB</b><br>Warranty Claim Report</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>

 

Regards,

 

Share this post


Link to post
Share on other sites
Danp2
8 minutes ago, nobounds said:

Trying this but can't seem to make it work.

That's not enough information for us to help. Does the code run? Are any errors shown in the Scite output panel?

P.S. Try adding a ConsoleWrite inside the For...Next so that you see what classes were found.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×