Sign in to follow this  
Followers 0
jrumbaug

<solved>I need to click on item in a table in I.E.

4 posts in this topic

#1 ·  Posted (edited)

What is the preffered way to click on a "link" in a dynamically created table??

I can click on items in forms, but I can not find out how to get a reference to an item in a table.

I know that on the page, it is table#4 (the fith table) row 0 , column 1

This code DOES NOT WORK:

;==================================

;======= get refernece to 5th table

$colTables = _IETableGetCollection($oIE,4)

$oElements = _IEFormElementGetCollection ($colTables)

;== @error = 4, Invalid Object Type, that is why it does not work

_IEFormElementClickValue( $oElements , "CustomerName" )

;===== end of program

;===== user defined function THAT DOES WORK when called with element and value from FORM

Func _IEFormElementClickValue( $oElements , $cName )

For $oElement IN $oElements

IF $oElement.value = $cName Then

_IEAction($oElement, "CLICK")

ENDIF

NEXT

Return

EndFunc

:====================================== end of code

Edited by jrumbaug

Share this post


Link to post
Share on other sites



First try changing

IF $oElement.value = $cName Then

to

IF String($oElement.value) = $cName Then

then post the HTML if still having trouble.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

DaleHolm

thanks for the suggestion, that did not "solve" the problem, though it did not hurt either. I have edited my original posting. I have found that IEFormElementGetCollection does not want what is returned by _IETableGetCollection. That makes since. One says "form", the other says "table" in the name.

per your suggestion, here is the html code

=============== html code of membersearch screen, with comments added by Jim Rumbaugh
=============== towards the bottom you will see this type of comment added by me
=============== that is where I think the table info is.   Jim Rumbaugh 3-2010



<html>
    <head>
        <title>Member Search</title>
        <link href="/eyefinity/html/eyefinity.css" rel="stylesheet" type="text/css">
        <link href="/idc/html/membersearch.css" rel="stylesheet" type="text/css"/>
        <script src="/global/html/cookie.js" type="text/javascript"></script>
        <script src="/global/html/nav_maps.js" type="text/javascript"></script>
        <script src="/global/html/quicklinks.js" type="text/javascript"></script>
        <script src="/eyefinity/html/eBuy.js" type="text/javascript"></script>
        <script src="/idc/html/membersearch.js" type="text/javascript"></script>
        <script type="text/javascript">
            
            var criteria = {"lastName":"graves","memberIdLast4":"9318","submit":"Search","asOfDate":"03/22/2010","searchType":"lastName_firstName_memberIdLast4","firstName":"nathan"};
            var error = {};
            var members = [{"memberIdLast4":"9318","lastName":"Graves","clientName":"GC SERVICES LIMITED","birthMonth":"6","state":"","birthDay":"23","firstName":"Nathan","suffix":"","key":"l*2MVxqsJjN*hTLIDhK4172SWdU-BiVT9J3eKDdaQsYXJU7Wglo4Ptc9dkKi1TXt5NpwaIriPC9G-hvp3mpv*qTBSd1f5ADWwhpOdYraaCo_","city":""}];
            var searchPerformed = true;
            // This openTracking function is derived from the function in vspOnline.htm.
            function openTracking() {
                var sGreeting = getCookie("VSPIDC_GREETING")
                var gLen = sGreeting.length
                if (sGreeting.substring(gLen-2, gLen-1) == "1") {
                    var tWindow=window.open('/idc/html/CLMProviderInq.htm',"VSPspotlight","toolbar=1,menubar=1,resizable=1,status=1,location=1,directories=1,scrollbars=1,width=600,height=400,screenX=50,top=100,screenY=100");
                    twindow.focus();
                } else {
                    alert("You do not have access to check claims status")
                }
            }
        </script>
    </head>
    <body>
        <table width="698" cellpadding="0" cellspacing="0" class="pageBorder">
            <tr>
                <td colspan="2"><img src="/eyefinity/images/nav_einsurance_elclaim.gif" border=0 usemap="#einsuranceBar"><br/><map name="einsuranceBar"><script type="text/javascript">
                    document.write(getEinsuranceNavBar());
                </script></map></td>
            </tr>
            <tr>
                <td id="leftnav" width="139">
                    <div class="navTxt1">
                        <div class="first"><a class="navLink" href="/eyefinity/html/vsponlinetransfer.htm?VSPOnlineRef=eInsurance_Nav">VSP Online</a></div>
                        <div><a class="navLink" href="javascript:openTracking()">Track VSP Claims</a></div>
                        <div><a class="navLink" href="/idrs/html/authlist.htm?from=membersearch.jsp">Track Outstanding Authorizations</a></div>
                    </div>
                    <div><img src="/global/images/nav_base.gif" width="139" height="11"/></div>
                </td>
                <td id="mainContent" width="558">
                    <form method="GET" id="form">
                        <input type="hidden" name="searchType"/>
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="vertical-align:bottom"><img width="8" height="12" src="/global/images/hd_ctopleft.gif"/></td>
                                <td style="background:url(/global/images/gray_pixel.png) repeat-x 0 12px;vertical-align:bottom"><img src="/idc/images/membersearch_title.png" width="133" height="19"/></td>
                                <td style="vertical-align:bottom"><img width="8" height="12" src="/global/images/hd_ctopright.gif"/></td>
                            </tr>
                            <tr>
                                <td style="background:url(/global/images/gray_pixel.png) repeat-y 3px 0"></td>
                                <td style="padding:0 8px">
                                    <table>
                                        <tr>
                                            <td class="first"><label for="firstName"/>First Name:</label></td>
                                            <td>
                                                <input name="firstName" id="firstName" maxlength="10"/>
                                                <label for="lastName"/>Last Name:</label>
                                                <input name="lastName" id="lastName" maxlength="20"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="first"><label for="dateOfBirth"/>DOB:</label></td>
                                            <td><input name="dateOfBirth" id="dateOfBirth" class="date" maxlength="10"/> <span class="help">mm/dd/yyyy</span></td>
                                        </tr>
                                        <tr>
                                            <td class="first">Member ID:</td>
                                            <td>
                                                <label for="memberIdLast4"/>Last 4 SSN</label>
                                                <input name="memberIdLast4" id="memberIdLast4" maxlength="4"/> or
                                                <label for="memberId"/>Full ID Only</label>
                                                <input name="memberId" id="memberId" maxlength="30"/>
                                                <label for="asOfDate"/>As of Date</label>
                                                <input name="asOfDate" id="asOfDate" class="date" maxlength="10"/> <span class="help">mm/dd/yyyy</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="first"></td>
                                            <td>
                                                <input type="button" id="reset" value="Reset"/>
                                                <input name="submit" id="submit" type="submit" value="Search" disabled="disabled" style="color:#808080"/>
                                                <span class="padLeft"><a id="helpLink" href="/idc/html/membersearch_help.htm">Valid Search Combinations</a></span>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td style="background:url(/global/images/gray_pixel.png) repeat-y 4px 0"></td>
                            </tr>
                            <tr>
                                <td><img width="8" height="12" src="/global/images/hd_cleft.gif"/></td>
                                <td style="background:url(/global/images/gray_pixel.png) repeat-x 0 6px"></td>
                                <td><img width="8" height="12" src="/global/images/hd_cright.gif"/></td>
                            </tr>
                        </table>
                    </form>
                    <div id="warning">
                        <span id="memberIdWarning" style="display:none">Searching by Full ID Only.</span>
                        
                        &nbsp;
                    </div>
============== This is where I think the table code is,  Jim Rumbaugh 3-2010==========
                    <div id="members" style="visibility:hidden">
                        <table>
                            <tr>
                                <td class="padLeft"><img src="/eyefinity/images/body_rule_tl.gif" alt="" width="9" height="27" border="0"></td>
                                <th class="name"><span id="heading_name" class="sorter">Name <img id="sort_name" src="/global/images/sort_active_desc.gif" width="7" height="9"/></span></th>
                                <th class="dateOfBirth"><span id="heading_dateOfBirth" class="sorter">DOB* <img id="sort_dateOfBirth" src="/global/images/sort_inactive.gif" width="7" height="9"/></span></th>
                                <th class="memberIdLast4"><span id="heading_memberIdLast4" class="sorter">ID Last 4 <img id="sort_memberIdLast4" src="/global/images/sort_inactive.gif" width="7" height="9"/></span></th>
                                <th class="stateCity"><span id="heading_stateCity" class="sorter">City, State <img id="sort_stateCity" src="/global/images/sort_inactive.gif" width="7" height="9"/></span></th>
                                <th class="clientDivision"><span id="heading_clientDivision" class="sorter">Client Name <img id="sort_clientDivision" src="/global/images/sort_inactive.gif" width="7" height="9"/></span></th>
                                <td class="padRight"><img src="/eyefinity/images/body_rule_tr.gif" alt="" width="9" height="27" border="0"></td>
                            </tr>
                        </table>
                        <div id="values">
                        </div>
                        <table>
                            <tr>
                                <td class="padLeft"><img src="/eyefinity/images/body_rule_bl.gif" alt="" width="9" height="27" border="0"></td>
                                <td id="summary">
                                    1 Results
                                    Found
                                </td>
                                <td class="padRight"><img src="/eyefinity/images/body_rule_br.gif" alt="" width="9" height="27" border="0"></td>
                            </tr>
                        </table>
                        <div id="footnote">
                            * For member privacy, the birth year is omitted.
                        </div>
                    </div>
                </td>
            </tr>
        </table>
        <iframe scrolling="no" src="/eyefinity/html/footers.inc?css=/eyefinity/html/eyefinity.css" width="699" height="16" marginheight="0" marginwidth="0" frameborder="0"></iframe>
    </body>
</html>

I have also attached a screen shot of the page

post-55186-12693692899378_thumb.jpg

Share this post


Link to post
Share on other sites

This work around has solved my problems. I looked at all the links on the page. Found the "common part" of the link that was in what I wanted to click, then made a FOR NEXT to find the link with that "common part". I consider this problem solved.

$oLinks = _IELinkGetCollection ($oIE)
For $oLink In $oLinks
    If StringInStr($oLink.href , "membersearch.jsp?" ) Then
        _IEAction($oLink, "click")
    EndIf
Next
_IELoadWait( $oIE )

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
Sign in to follow this  
Followers 0