Jump to content

Javascript and _IE , Click on TD


 Share

Recommended Posts

I need to be able to click on menuname r.2 (CLAIMS). There is no ID just a list of TD's. Been working on this over 1 week. I need help please.

 

<!DOCTYPE HTML>
<html>
<head>
    <title>GMS</title>
    <meta http-equiv="Expires" content="0" />
    <link rel="stylesheet" type="text/css" href="main.css" />
    <link rel="stylesheet" type="text/css" href="custom/main.css" />
    <link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css" />
    
    <script type="text/javascript">
        var _uid ='blahblah';
        var _sid = 'blahblah';
        
    </script>
    <script type="text/javascript" src="menus.js"></script>
    <script type="text/javascript" src="main.js"></script>
    <script type="text/javascript" src="ajaxmethods.js"></script>
    <script type="text/javascript" src="jquery/jquery.js"></script>
    <script type="text/javascript" src="jquery/jquery-ui.js"></script>

</head>

<body onload="window.name='gmsmain'; if(document.all(rootmenuname)){document.all(rootmenuname).style.visibility='inherit';};">
    <div class="logo"></div>

    <div class="user-profile"><a href="javascript:openuserprofile();">blah blah</a></div>

    
    <div class="account-name">
        ONKYO</div>
    
    <!--    
    <div class="sentitems"><a Href="javascript:openEmails();">Sent Items</a></div>
    <div class="newmail"><a Href="javascript:newEmail();">New Email</a></div>
-->
    <div class="logout">
        <a href="default.aspx?_sid=585614&_uid=blahblah&logout=true">Log out</a></div>
    
    <div class="launch-box">
        <form id="frmlaunch" style="margin: 0px" name="frmlaunch" onsubmit="return launch(this.programname);"
        method="post">
        Launch program <input type="text" id="programname" name="programname" maxlength="40">
        </form>
    </div>
    <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>
<tr menuname="r.5" onclick="modclk(this,'WEB.CLAIMS','CSOP*SALES.INQ.WEB.D','SALES.INQ.WEB.D');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>SALES.INQ.WEB.D</b><br>Sales Order Inquiry</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.6" onclick="modclk(this,'WEB.CLAIMS','CSOP*PARTS.ORDERS','PARTS.ORDERS');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>PARTS.ORDERS</b><br>Order Entry</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.7" onclick="modclk(this,'WEB.CLAIMS','CSOP*PART.SEARCH','PART.SEARCH');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>PART.SEARCH</b><br>Part Price and Availability Search</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.8" onclick="modclk(this,'WEB.CLAIMS','CSOP*INVOICE.PRINT.WEB','INVOICE.PRINT.WEB');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>INVOICE.PRINT.WEB</b><br>Invoice Print</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.9" onclick="modclk(this,'WEB.CLAIMS','CSOP*INV.INQ.WEB','INV.INQ.WEB');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>INV.INQ.WEB</b><br>Invoice Inquiry</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.10" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*AR.ACTIVITY.DEALER','AR.ACTIVITY.D');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>AR.ACTIVITY.D</b><br>Accounts Receivable Activity</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.11" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*AR.ATB.CB.WEB','AR.ATB.CB.WEB');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>AR.ATB.CB.WEB</b><br>Accounts Receivable Aging</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.12" onclick="modclk(this,'WEB.CLAIMS','CSOP*SALES.VS.PARTS','SALES.VS.PARTS');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>SALES.VS.PARTS</b><br>Product Sales vs Part Sales Report</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.13" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*PART.USAGE','PART.USAGE');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>PART.USAGE</b><br>Part Purchase vs Claims (Including Substitute PNs)</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.14" onclick="modclk(this,'WEB.CLAIMS','CSOP*SRVC.LTD.LIST','SRVC.LTD.LIST');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>SRVC.LTD.LIST</b><br>Direct and Distributor Authorized Dealer List</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.15" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*SRVC.PSWD','SRVC.PSWD');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>SRVC.PSWD</b><br>Change your Password</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.16" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*PCB.REQUEST','PCB.REQUEST');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>PCB.REQUEST</b><br>Request a Replacement PCB or Speaker</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.17" onclick="modclk(this,'WEB.CLAIMS','O*PCB.RPT','PCB.RPT');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>PCB.RPT</b><br>Show PCB Requests</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.18" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*RETURN.LIST','RETURN.LIST');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>RETURN.LIST</b><br>Report of Models Returned and Status</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.19" onclick="modclk(this,'WEB.CLAIMS','CUSTOM*RETURN.LIST.STAT','RETURN.LIST.STAT');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>RETURN.LIST.STAT</b><br>Change Status of Models Returned</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
<tr menuname="r.20" onclick="modclk(this,'WEB.CLAIMS','O*TEST.CLAIMS','TEST.CLAIMS');" OnMouseOver="mOver(this);" OnMouseOut="mOut(this);"><td><b>TEST.CLAIMS</b><br>Enter Claims Using Sales Invoices</td><td align=right><img src="images/..\Custom\images\module.gif" align=absmiddle></td></tr>
</table>
</div>

    <div class="copyright">
        10.25.16 v.4.1.9 Multi-browser version.</div>
    
    <div align="center" class="menu-message">
        QUICK LAUNCH: Enter your command in the Launch program box.
    </div>
    
    <div align="center" class="help-line">
        Need more information? Please contact your administrator at OnkyoUSA, 201-785-2600 or Email: ITFadmin@us.onkyo.com
    </div>
    
    
    <iframe name="frameheartbeat" style="position: absolute; top: 400px; left: 20px; width: 400px; height: 150px; display: none;"></iframe>

    <script type="text/javascript" language="javascript">
    var WindowSizeArray=[['WEB.CLAIMS','CUSTOM*SSE','SSE',20,80]
,['WEB.CLAIMS','O*CLAIMS','CLAIMS',24,80]
,['WEB.CLAIMS','CSOP*SALES.INQ.WEB.D','SALES.INQ.WEB.D',25,75]
,['WEB.CLAIMS','O*TEST.CLAIMS','TEST.CLAIMS',25,85]
];
    function GetWindowArguments(menuname, screenkey, procname)
    {
        //alert(menuname + ',' +screenkey + ',' +  procname);
        var popup_height= 600; //520;
        var popup_width = 900; //720;
        
        for(var w=0;w<WindowSizeArray.length;w++)
        {
            if (WindowSizeArray[w][2]==procname)
            {
                if (menuname.length>0 && screenkey.length>0)
                {
                    //if all parameters specified 
                    if (WindowSizeArray[w][0]==menuname && WindowSizeArray[w][1]==screenkey)
                    {
                        popup_height= Number( WindowSizeArray[w][3] ) * 22;
                        popup_width = Number(WindowSizeArray[w][4]) * 9;
                    }
                }
                else
                {
                    //if only procname specified thats fine
                    popup_height= Number( WindowSizeArray[w][3] * 22);
                    popup_width = Number(WindowSizeArray[w][4]) * 9 ;
                }
            }
        }
        var popup_left = (screen.width-popup_width)/2;
        var popup_top = (screen.height-popup_height)/2;

        var args='status=1,resizable=1,toolbar=0,scrollbars=0,directories=0,menubar=0,left=' + popup_left + ',top=' + popup_top + ',width=' + popup_width + ',height=' + popup_height;
        return args;
      }

    </script>
</body>
</html>

Regards

Edited by nobounds
Link to comment
Share on other sites

 

5 hours ago, Danp2 said:

So you just gave up on your prior thread with the same issue?

 

If I could delete it I would have. It was messy to understand. I found a post in FAQ how codes should be posted a certain way. I am currently trying to understand how XPATH works. I know you made a reference to XPATH but I didn't understand it.  I'm a older C++ programmer who spent last so many years as electronic repair technician. It's taking me a while to understand everything. It's been long time since I went to school for all this. Once I find a solution for I will post what I found to help others working with JavaScript websites. I am thankful for the help so far.

I also took your suggesting and inserted ConsoleWrite(). Using this I was able to see my object $oIE was not updating once the page logged in. It was still reading from the initial instance. I had to create a array of all instances and loop through them to get the object $oIE to update. I think it has something to do with the fact the entire site seems to be javascript based.

These websites I'm working with are from manufactures from Sony, Onkyo, LG, Samsung ect. These are not regular websites. I have to make sure what I post does not leak any security problems that can effect our company  being authorized to access them. I'm having to go through line by line all code I post.

Regards,

Edited by nobounds
Link to comment
Share on other sites

13 hours ago, jdelaney said:

You can use my signature with an xpath like this //table//td[@menuname='r.2']

Doesn't work. See below.

$xpathForumLink = "//table//td[@menuname='r.2']"
$oIE = _IEAttach("GMS")
If IsObj($oIE) Then
    ConsoleWrite("$oIE attached success" & @CRLF)
Else
    ConsoleWrite("$oIE attached failed" & @CRLF)
    Exit 1
EndIf

$aForumLink = BGe_IEGetDOMObjByXPathWithAttributes($oIE,$xpathForumLink)
If IsArray($aForumLink) Then
    ConsoleWrite("Able to BGe_IEGetDOMObjByXPathWithAttributes($oIE, " & $xpathForumLink & ")" & @CRLF)
    For $i = 0 To UBound($aForumLink)-1
        ConsoleWrite("   " & $aForumLink[$i].outerhtml & @CRLF)
    Next
Else
    ConsoleWrite("UNable to BGe_IEGetDOMObjByXPathWithAttributes($oIE, " & $xpathForumLink & ")" & @CRLF)
    Exit 2
EndIf


_IEAction($aForumLink[0], "focus")
If _IEAction($aForumLink[0], "click") Then
    ConsoleWrite("Able to _IEAction($aForumLink[0], 'click')" & @CRLF)
    _IELoadWait($oIE)
Else
    ConsoleWrite("UNable to _IEAction($aForumLink[0], 'click')" & @CRLF)
    Exit 3
EndIf

Here's what console says

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "J:\Paradox Project\3.au3"    
$oIE attached success
Start Function=[BGe_IEGetDOMObjByXPathWithAttributes] with $sXPath=[//table//td[@menuname='r.2']].
@menuname='r.2'
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[table], $bNodeIsRelative=[True] $bIsConstrainted=[False].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[1]: $sNodeName=[td], $bNodeIsRelative=[True] $bIsConstrainted=[True].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[table], $bNodeIsRelative=[True] $bIsConstrainted=[False].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[1]: $sNodeName=[td], $bNodeIsRelative=[True] $bIsConstrainted=[True].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[table], $bNodeIsRelative=[True] $bIsConstrainted=[False].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[1]: $sNodeName=[td], $bNodeIsRelative=[True] $bIsConstrainted=[True].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[table], $bNodeIsRelative=[True] $bIsConstrainted=[False].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[1]: $sNodeName=[td], $bNodeIsRelative=[True] $bIsConstrainted=[True].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[0]: $sNodeName=[table], $bNodeIsRelative=[True] $bIsConstrainted=[False].
Start Function=[BGe_RecursiveGetObjWithAttributes] level=[1]: $sNodeName=[td], $bNodeIsRelative=[True] $bIsConstrainted=[True].
UNable to BGe_IEGetDOMObjByXPathWithAttributes($oIE, //table//td[@menuname='r.2'])
>Exit code: 2    Time: 3.059

Regards,

Link to comment
Share on other sites

Oops, misread that.  Looks like it should be a td to me also.   But if it works then the snapshot of html provided just didn't include it.  Glad you figured it out. 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...