Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate IE - How to run javascript function as a url or Find a Link 1

Status
Not open for further replies.

pcast01

Programmer
Sep 17, 2001
62
US
I am trying to find a link on a web page but I am unable to find it with VBSCRIPT but cannot find it. So I am now trying to find out how to run Javascript function. Either way I cannot click the link or run the javascript function. Help?

I have tried several different things to find it the link but i can't seem to find it.

Here is the Code I have tried.
Code:
set urls = ie.document.all.tags("a")
For x = 0 to (urls.length)-1
    wscript.echo urls(x).innerHTML & " : " & urls(x).href
Next
wscript.echo "Number of URLs:", urls.length, vbNewline

I tried this and it gave me zero url's.

Here is the html code:
Code:
<a href=javascript:doSubmit('lnvprl','') title="Display VPS Printer List">VPS Printer List</a>

I also have tried to run the javascript code with this:
Code:
ie.navigate2("javascript:doSubmit('lnvprl','')")

But this doesn't do anything...

Can anyone shed some light on this?



CHAOS, PANIC, & DISORDER - my work here is done.
 
[1] The way of referencing "urls" collection should be just fine. If the ie visible is set to true, you should be able to see the page. Is there loading problem 404 or unable to connect...?

[2] You should quote the href.
><a href=javascript:doSubmit('lnvprl','') title="Display VPS Printer List">VPS Printer List</a>
[tt]<a href=[red]"[/red]javascript:doSubmit('lnvprl','')[red]"[/red] title="Display VPS Printer List">VPS Printer List</a>[/tt]

[3] To trigger the anchor link, click method should be fine.
[tt] url(x).click() 'for some x[/tt]
 
Ok, I have tried to do this:
Code:
set urls = ie.document.all.tags("a")
For x = 0 to (urls.length)-1
    wscript.echo urls(x).innerHTML & " : " & urls(x).href
Next
wscript.echo "Number of URLs:", urls.length, vbNewline

It comes back with zero URL's found even though there are several used in this page. Is there another way I can search thru links/urls?

The links are all in Tables, could that be a problem?

I am trying some more things and will post any progress.

Thanks for the help.


CHAOS, PANIC, & DISORDER - my work here is done.
 
The appearance is deceptive. Those many things can be in a frame, iframe... View the source code to discover any sign of it.
 
No frames in the source.
They are all in a form within tables.

Any other ideas?!

CHAOS, PANIC, & DISORDER - my work here is done.
 
I am not that convinced..., but you've the page and I've not.
 
I will post the html source today.

CHAOS, PANIC, & DISORDER - my work here is done.
 
Here it is:

I HIGHLIGHTED all the stuff we are working with.

Code:
<!-- ECS=IBM-037 --><!-- V1R10.0067 -->
<!-- The HTML template source for this page in host is PDS member: lnvprm
     Member suffix (if any) in use: -->
<html>
 <head>
  <meta http-equiv="Expires" content="0">
  <meta http-equiv="Pragma" content="no-cache">
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <meta name="formatter" content="LRS VMCF Web Access">
  <title>VMCF Web Access Primary Menu</title>
  <link rel="stylesheet" type="text/css" href="/vmcf/vwacss.htm"></link>
  <link rel="stylesheet" type="text/css" href="/vmcf/vwacss.htm"></link>
  <style type="text/css">
   .r1 { font-family: MS Sans Serif; font-size:7.5pt; color:#FF0000; white-space:nowrap }
   .r2 { font-family: MS Sans Serif; font-size:10pt; color:#FF0000; white-space:nowrap }
   .r3 { font-family: MS Sans Serif; font-size:12pt; color:#FF0000; white-space:nowrap }
   .r4 { font-family: MS Sans Serif; font-size:14pt; color:#FF0000; white-space:nowrap }
   .r5 { font-family: MS Sans Serif; font-size:18pt; color:#FF0000; white-space:nowrap }
   .r6 { font-family: MS Sans Serif; font-size:24pt; color:#FF0000; white-space:nowrap }
   .r7 { font-family: MS Sans Serif; font-size:36pt; color:#FF0000; white-space:nowrap }
   .s1 { font-family: MS Sans Serif; font-size:7.5pt; color:#000000; white-space:nowrap }
   .s2 { font-family: MS Sans Serif; font-size:10pt; color:#000000; white-space:nowrap }
   .s3 { font-family: MS Sans Serif; font-size:12pt; color:#000000; white-space:nowrap }
   .s4 { font-family: MS Sans Serif; font-size:14pt; color:#000000; white-space:nowrap }
   .s5 { font-family: MS Sans Serif; font-size:18pt; color:#000000; white-space:nowrap }
   .s6 { font-family: MS Sans Serif; font-size:24pt; color:#000000; white-space:nowrap }
   .s7 { font-family: MS Sans Serif; font-size:36pt; color:#000000; white-space:nowrap }
   .w1 { font-family: MS Sans Serif; font-size:7.5pt; color:#FFFFFF; white-space:nowrap }
   .w2 { font-family: MS Sans Serif; font-size:10pt; color:#FFFFFF; white-space:nowrap }
   .w3 { font-family: MS Sans Serif; font-size:12pt; color:#FFFFFF; white-space:nowrap }
   .w4 { font-family: MS Sans Serif; font-size:14pt; color:#FFFFFF; white-space:nowrap }
   .w5 { font-family: MS Sans Serif; font-size:18pt; color:#FFFFFF; white-space:nowrap }
   .w6 { font-family: MS Sans Serif; font-size:24pt; color:#FFFFFF; white-space:nowrap }
   .w7 { font-family: MS Sans Serif; font-size:36pt; color:#FFFFFF; white-space:nowrap }
  </style>
  <script language="JavaScript1.2" src="/vmcf/vmcf.js"></script>
  <script language="JavaScript1.2" src="/vmcf/vmcf.js"></script>
  <script language="javascript">
   var submit = 0;
   var btype = 0;

   function doOnLoad()
    {
    document.LNVPRM.brwid.value = navigator.appName;
    if  (navigator.appName == "Netscape")
     {
     btype = 1;
     }

    if  (document.LNVPRM.showplg.value == 1)
     {
     command = "/LRS/webconnect/VPSNET?trid=vmfplg&tridsfx=&sid=C22F650EE0302280&srvid=VSV&usid=op74216&newwin=1&brwid=";
     command = command + navigator.appName;
     parms   = "resizable=yes,scrollbars=yes";
     window.open(command,
                 "_blank",
                 parms);
     }
    }

   [b][COLOR=red]function doSubmit(type,subtype)
    {
    submit = 1;

    switch(type)
     {
     case "logovf":
      parent.NormalLogoff = 1;
      document.LNVPRM.trid.value  = type;
      document.LNVPRM.strid.value = subtype;
      break;

     case "close":
      submit = 0;
      close();
      break;

     case "vmusrp":
     case "vmusrl":
      submit = 0;
      command = "/LRS/webconnect/VPSNET?trid=" + type;
      command = command + "&strid="    + subtype;
      command = command + "&usid="     + LRSCvtToWebFmt(document.LNVPRM.usid.value);
      command = command + "&sid="      + document.LNVPRM.sid.value;
      command = command + "&srvid="    + document.LNVPRM.srvid.value;
      command = command + "&tridsfx="  + document.LNVPRM.tridsfx.value;
      command = command + "&brwid="    + LRSCvtToWebFmt(document.LNVPRM.brwid.value);
      command = command + "&newwin=1";
      parms   = "resizable=yes,scrollbars=yes";
      window.open(command,
                  "_blank",
                  parms);
      break;

     case "lnvpjq":
      document.LNVPRM.trid.value  = type;
      document.LNVPRM.strid.value = "";
      document.LNVPRM.qtype.value = subtype;
      document.LNVPRM.tabid.value = 1;
      break;

     case "lnvphq":
      document.LNVPRM.trid.value  = type;
      document.LNVPRM.strid.value = "";
      document.LNVPRM.qtype.value = subtype;
      document.LNVPRM.tabid.value = 2;
      break;

     case "lnvprq":
      document.LNVPRM.trid.value  = type;
      document.LNVPRM.strid.value = "";
      document.LNVPRM.qtype.value = subtype;
      document.LNVPRM.tabid.value = 3;
      break;

[URL unfurl="true"]http://h002.XXXX.com/LRS/webconnect/VPSNET?trid=lnvpr1&tridsfx=&sid=C21637907C3F2140&srvid=VSV&usid=op74216&clswin=1[/URL]

     case "lnvpr1":
      document.LNVPRM.trid.value  = type;
      document.LNVPRM.strid.value = "";
      document.LNVPRM.qtype.value = subtype;
      document.LNVPRM.tabid.value = 4;
      break;

     case "lnvpul":
      document.LNVPRM.trid.value  = type;
      document.LNVPRM.strid.value = "";
      document.LNVPRM.viewtype.value = subtype;
      document.LNVPRM.listtype.value = "prt";
      break;

     case "lnvqul":
      document.LNVPRM.trid.value  = "lnvpul";
      document.LNVPRM.strid.value = "";
      document.LNVPRM.viewtype.value = subtype;
      document.LNVPRM.listtype.value = "que";
      break;

     case "lnvaul":
      document.LNVPRM.trid.value  = "lnvpul";
      document.LNVPRM.strid.value = "";
      document.LNVPRM.viewtype.value = subtype;
      document.LNVPRM.listtype.value = "afp";
      break;

     case "lnvvpl":
      document.LNVPRM.trid.value  = type;
      document.LNVPRM.strid.value = "";
      document.LNVPRM.viewtype.value = subtype;
      document.LNVPRM.listtype.value = "prt";
      break;

     case "lnvvql":
      document.LNVPRM.trid.value  = "lnvvpl";
      document.LNVPRM.strid.value = "";
      document.LNVPRM.viewtype.value = subtype;
      document.LNVPRM.listtype.value = "que";
      break;

     case "lnvvrl":
      document.LNVPRM.trid.value  = "lnvvpl";
      document.LNVPRM.strid.value = "";
      document.LNVPRM.viewtype.value = subtype;
      document.LNVPRM.listtype.value = "afp";
      break;

     default:
      switch(subtype)
       {
       case "help":
        submit = 0;
        command = "/vmcf/vprmhp.htm";
        parms   = "resizable=yes,scrollbars=yes";
        window.open(command,
                    "_blank",
                    parms);
        break;

       case "newwin":
        submit = 0;
        command = "/LRS/webconnect/VPSNET?trid=lnvprm";
        command = command + "&strid="      + subtype;
        command = command + "&usid="       + LRSCvtToWebFmt(document.LNVPRM.usid.value);
        command = command + "&sid="        + document.LNVPRM.sid.value;
        command = command + "&srvid="      + document.LNVPRM.srvid.value;
        command = command + "&ltrid="      + document.LNVPRM.ltrid.value;
        command = command + "&brwid="      + LRSCvtToWebFmt(document.LNVPRM.brwid.value);
        command = command + "&tridsfx="    + document.LNVPRM.tridsfx.value;
        command = command + "&prtid="      + LRSCvtToWebFmt(document.LNVPRM.prtid.value);
        command = command + "&grpid="      + LRSCvtToWebFmt(document.LNVPRM.grpid.value);
        command = command + "&statid="     + document.LNVPRM.statid.value;
        command = command + "&newwin=1";
        parms   = "resizable=yes,scrollbars=yes";
        window.open(command,
                    "_blank",
                    parms);
        break;

       case "vpc":
        submit = 0;
        command = "/LRS/webconnect/VPSNET?trid=mblist";
        command = command + "&strid="      + subtype;
        command = command + "&usid="       + LRSCvtToWebFmt(document.LNVPRM.usid.value);
        command = command + "&sid="        + document.LNVPRM.sid.value;
        command = command + "&srvid="      + document.LNVPRM.srvid.value;
        command = command + "&brwid="      + LRSCvtToWebFmt(document.LNVPRM.brwid.value);
        command = command + "&tridsfx="    + document.LNVPRM.tridsfx.value;
        command = command + "&ltrid="      + document.LNVPRM.ltrid.value;
        command = command + "&newwin=1";
        parms   = "resizable=yes,scrollbars=yes";
        window.open(command,
                    "_blank",
                    parms);
        break;

       case "dmcf":
        submit = 0;
        command = "/LRS/webconnect/VPSNET?trid=lndprm";
        command = command + "&strid="      + subtype;
        command = command + "&usid="       + LRSCvtToWebFmt(document.LNVPRM.usid.value);
        command = command + "&sid="        + document.LNVPRM.sid.value;
        command = command + "&srvid="      + document.LNVPRM.srvid.value;
        command = command + "&brwid="      + LRSCvtToWebFmt(document.LNVPRM.brwid.value);
        command = command + "&tridsfx="    + document.LNVPRM.tridsfx.value;
        command = command + "&ltrid="      + document.LNVPRM.ltrid.value;
        command = command + "&newwin=1";
        parms   = "resizable=yes,scrollbars=yes";
        window.open(command,
                    "_blank",
                    parms);
        break;

       default:
        document.LNVPRM.trid.value  = type;
        document.LNVPRM.strid.value = subtype;
       }
      }

    if  (submit == 1)
     {
     document.LNVPRM.submit();
     }
    }[/color][/b]

   function Toggle(item)
    {
    obj = document.getElementById(item);
    visible = (obj.style.display != "none")
    img = document.getElementById("i" + item);
    if  (visible)
     {
     obj.style.display = "none";
     img.src = "/vmcf/plus.gif";
     }
    else
     {
     obj.style.display = "block";
     img.src = "/vmcf/minus.gif";
     }
    }
  </script>
 </head>
 <body bgcolor="#FFFFFF" leftmargin="0" marginwidth="0" marginheight="0" onLoad="doOnLoad()" style="overflow:auto;" text="#000000" topmargin="0">
  <form method="POST" action="/LRS/webconnect/VPSNET" name="LNVPRM">
   <input type="hidden" name="srvid" value="VSV">
   <input type="hidden" name="trid" value="lnvprm">
   <input type="hidden" name="ltrid" value="lnvprm">
   <input type="hidden" name="vtrid" value="lnvprm">
   <input type="hidden" name="tridsfx" value="">
   <input type="hidden" name="strid">
   <input type="hidden" name="jtrid">
   <input type="hidden" name="qtype">
   <input type="hidden" name="listtype">
   <input type="hidden" name="viewtype">
   <input type="hidden" name="tabid">
   <input type="hidden" name="sid" value="C22F650EE0302280">
   <input type="hidden" name="rid" value="13678">
   <input type="hidden" name="showplg" value="0">
   <input type="hidden" name="usid" value="op74216">
   <input type="hidden" name="brwid" value="Microsoft Internet Explorer">
   <input type="hidden" name="newwin" value="">
   <input type="hidden" name="acs" value="">
   <input type="hidden" name="ecs" value="">
   <input type="hidden" name="svrlst" value="Y">
   <input type="hidden" name="svrlst" value="Y">
   <input type="hidden" name="css" value="">
   

   <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr class="drk">
     <td class="w3" height="33%" nowrap width="28%">VMCF Web Access&nbsp;&nbsp;<font class="w1">(VSV)</font></td>
     <td height="33%" nowrap width="18"><img border="0" src="/vmcf/curve.gif" alt="" height="100%" width="18"></td>
     <td align="right" bgcolor="#000000" class="w1" nowrap>
      <a class="a2" href=javascript:doSubmit('lnvprm','') title="Return to VMCF Primary Menu">Main</a> |
      
      <a class="a2" href=javascript:doSubmit('vmusrp','') title="Modify Personal Preferences"> Preferences</a> |
      <a class="a2" href=javascript:doSubmit('','newwin') title="Open This Page in New Window"> New Window</a> |
      <a class="a2" href=javascript:doSubmit('logovf','') title="Logoff of VMCF Web Access"> Logoff </a> |
      
      <a class="a2" href=javascript:doSubmit('','help') title="Help for VMCF Web Access Primary Menu">Help</a>&nbsp;&nbsp;
     </td>
    </tr>
   </table>
   <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr class="drk">
     <td align="center" class="w3" height="20" nowrap width="100%">VMCF Primary Menu</td>
    </tr>
   </table>
   <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr class="drk" width="100%">
     <td class="w1" height="20" nowrap>&nbsp;&nbsp;<a class="a2" href=javascript:doSubmit('lnvprm','refresh') title="Refresh VMCF Primary Menu">Refresh</a></td>
    </tr>
   </table>
   <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
     <td height="2" nowrap width="100%"><img border="0" src="/vmcf/shadow.gif" alt="" height="100%" width="100%"></td>
    </tr>
   </table>

   
   
   <table width="100%">
    <tr>
     <td nowrap valign="top" class="s1">
      <table width="100%">
       <tr>
        <td nowrap align="left" class="s1" valign="top" width="33%">
         <table>
          <tr class="drk">
           <td align="center" class="w1" colspan="2"><b>VPS Printer List</b></td>
          </tr>
          <tr>
           <td>&nbsp;</td>
          </tr>
          <tr class="s1">
           <td width="6"><b>Printer:</b>&nbsp;&nbsp;</td>
           <td><input type="text" size="16" name="prtid" value="R2012" maxlength="8"></td>
          </tr>
          <tr class="s1">
           <td width="6"><b>Group:</b>&nbsp;&nbsp;&nbsp;</td>
           <td><input type="text" size="16" name="grpid" value="" maxlength="8"></td>
          </tr>
          <tr class="s1">
           <td width="6"><b>Status:</b>&nbsp;&nbsp;</td>
           <td>
            <select name="statid">
             <option value="">Select Status for Printer Command
             <option value="A" >Active
             <option value="D" >Drained
             <option value="E" >Error Drained
             <option value="I" >Idle
             <option value="M" >Missing Response
             <option value="W" >WConnect
            </select>
           </td>
          </tr>
          <tr>
           <td>&nbsp;</td>
          </tr>
         </table>
         <table>
          <tr>
           <td nowrap class="s1"><img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvpcm','') title="Issue VPS Printer Command">Enter VPS Printer Command</a><br>
           <img class="i1" src="/vmcf/holder.gif">[u][b][COLOR=red]<a href=javascript:doSubmit('lnvprl','') title="Display VPS Printer List">VPS Printer List</a>[/color][/b][/u]<br>
           
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvphq','h') title="Display VPS Printer Held Queue">VPS Printer Held Queue</a><br>
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvprq','r') title="Display VPS Printer Retained Queue">VPS Printer Retained Queue</a><br>
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvpjq','o') title="Display VPS Printer Output Queue">VPS Printer Output Queue</a><br>
            
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvpr1','') title="Display VPS Printer Summary Screen">VPS Printer Summary</a>
           </td>
          </tr>
         </table>
        </td>
        <td nowrap align="center" class="s1" valign="top" width="33%">
         <table>
          
           <tr class="drk">
            <td class="w1" align="center"><b>&nbsp;&nbsp;VPS Started Task List&nbsp;&nbsp;</b></td>
           </tr>
           <tr>
            <td class="s1">&nbsp;</td>
           </tr>
           <tr>
            <td nowrap class="s1"><img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvsll','') title="Display VPS Started Task List">VPS Started Task List</a><br>
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvstr','') title="Start VPS System">Start VPS System</a></td>
           </tr>
          
          <tr>
           <td class="s1">&nbsp;</td>
          </tr>
          
          
         </table>
        </td>
        <td nowrap align="right" class="s1" valign="top" width="33%">
         <table>
          
           <tr class="drk">
            <td align="center" class="w1" ><b>Server Options</b></td>
           </tr>  [URL unfurl="true"]http://h002.XXXX.com/LRS/webconnect/VPSNET?trid=logovf&tridsfx=&sid=C21637907C3F2140&srvid=VSV&usid=op74216&clswin=1[/URL]
           <tr>
            <td class="s1">&nbsp;</td>
           </tr>
           <tr>
            <td class="s1" nowrap><img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnsvdc','') title="Display Server Commands">Server Commands</a><br>
             <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvsr1','') title="Display Server Options">Server Options</a><br>
             <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvsta','') title="Display Server Statistics">Server Statistics</a><br>
             <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvexs','') title="Display Server Exits">Server Exits</a><br>
             <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnsuls','') title="Display Server User List">Server User List</a><br>
             <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnprfm','') title="Display Server User Profiles">Server User Profiles</a><br>
             <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvsky','') title="Display Server Keys">Server Keys</a>
            </td>
           </tr>
           <tr>
            <td class="s1">&nbsp;</td>
           </tr>
          
          <tr class="drk">
           <td align="center" class="w1"><b>Views</b></td>
          </tr>
          <tr>
           <td class="s1">&nbsp;</td>
          </tr>
          <tr>
           <td class="s1" nowrap><img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvpul','USER') title="Display User Views for Printer List">User Views for Printer List</a><br>
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvpul','GLOBAL') title="Display Global Views for Printer List">Global Views for Printer List</a><br>
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvvpl','') title="Display System Views for Printer List">System Views for Printer List</a><br>
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvqul','USER') title="Display User Views for Queue List">User Views for Queue List</a><br>
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvqul','GLOBAL') title="Display Global Views for Queue List">Global Views for Queue List</a><br>
            <img class="i1" src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvvql','') title="Display System Views for Queue List">System Views for Queue List</a><br>
            <img class=i1 src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvaul','USER') title="Display User Views for AFP Cached Resource List">User Views for AFP Cached Resource List</a><br>
            <img class=i1 src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvaul','GLOBAL') title="Display Global Views for AFP Cached Resource List">Global Views for AFP Cached Resource List</a><br>
            <img class=i1 src="/vmcf/holder.gif"><a href=javascript:doSubmit('lnvvrl','') title="Display System Views for AFP Cached Resource List">System Views for AFP Cached Resource List</a>
           </td>
          </tr>
         </table>
        </td>
       </tr>
      </table>
     </td>
    </tr>
   </table>
   <hr class="clr" width="100%">
  </form>
 </body>
</html>

CHAOS, PANIC, & DISORDER - my work here is done.
 
Ok, I have found out some new information.

I just tried this:
Code:
For x = 1 to ie.document.all.length -1
     msgbox ie.document.all.item(x).tagname
next

And this returned back FRAMES tag at least twice.
I am confused. I don't know much about html but it seams as thought this web page is setup differently than normal. Its more like an application.

Is there anyway to search the frames or something?

Any help would be appreciated. :)

CHAOS, PANIC, & DISORDER - my work here is done.
 
In that case, you can get the top level anchor links and to each frame's links like this.
[tt]
wscript.echo "Number of URLs:", urls.length, vbNewline
set urls = ie.document.all.tags("a")
For x = 0 to (urls.length)-1
wscript.echo urls(x).innerHTML & " : " & urls(x).href
Next

set urls=nothing
set cframe=ie.document.frames
wscript.echo "Number of Frames: ", cframe.length:, vbNewline
for x=0 to cframe.length-1
wscript.echo "frame-" & x & " : " & "Number of URLs :" & urls.length & vbNewline
set urls=cframe(x).document.all.tags("a")
for y=0 to urls.length-1
wscript.echo "frame-" & x & " : " & urls(y).innerHTML & " : " & urls(y).href
next
next
[/tt]
 
Thank you! I am finally able to find the link. This has been very difficult and frustrating.

Thank you for all your help.

I have another problem though, I know need to click a certain link.

How can I do that?

I have tried.
Code:
url.click()

but no luck, it gives me an error telling me that "object required." So i must be using the wrong syntax.


CHAOS, PANIC, & DISORDER - my work here is done.
 
You have to make sure url as you use it like the above is the reference to the anchor. It is illustrated in my first response.
[tt] urls(x).click() 'for certain index x[/tt]
To identify the index x, you check the criteria such as its href or its innerHTML.
 
Amendment
Upon re-read my last but one post, I'd obviously moved the echo line up too much. (You no doubt have noticed it). It should be read like this.
[tt]
set urls = ie.document.all.tags("a")
[blue]'obviously below the urls setup[/blue]
wscript.echo "Number of URLs:", urls.length, vbNewline
'etc etc
[/tt]
 
Ok, i will try to find it as an anchor.

I did have to move some lines around to get that from your code. No problem

I am getting an error now... when it gets to the line:
Code:
 set urls=cframe(x).document.all.tags("a")

an error pops up with "access denied". I got this error before but only on certain parts of the frames.

any ideas?

CHAOS, PANIC, & DISORDER - my work here is done.
 
Also I'd another typos.
[tt]wscript.echo "Number of Frames: ", cframe.length[highlight],[/highlight] vbNewline[/tt]

[1] As to the access denied, it is certainly a cross-domain security issue. That seems to suggests that the page in the frame is from some domain alien to the document domain of the top level.

[1.1] If you've the control of the toplevel page, a way out is to make it an hta. This is a hugh operation. You must trust that domain as if you trust your system administrator.
[1.2] Or you may try to put the domain of the page within the frames as a trusted domain.

Both involve security setting, that's your decision.

[2] If the domain in the frames are of the same domain of the top level page, access should be permitted. But I cannot say I know it all.
 
Well i don't have that kind of control. I guess I am back to square one. I was able to get those links but for some reason i get that error every time now.

Is there a way to call the javascript code?

This site requires me to log on to it which i failed to mention then the page that we have been working on is where I am trying to click this certain link.

This has proved very difficult. I don't want to give up quite yet. If there are any suggestions I am completely open.

Thanks again tsuji!

CHAOS, PANIC, & DISORDER - my work here is done.
 
Ok, got an update.

There are two forms that i find and the first frame i have access too and it has all the links on it.

The second frame is giving me the access denied but I don't need that frame.

Now I just need to click on the link.

CHAOS, PANIC, & DISORDER - my work here is done.
 

It works!!!

I now need to find all the checkboxes and check them all then click button.

I think I can find that.

Thanks again for all your help tsuji, you have been a tremendous help. [bigsmile]

CHAOS, PANIC, & DISORDER - my work here is done.
 
Thanks again tsuji. I got it all figured out. You were the biggest help.

CHAOS, PANIC, & DISORDER - my work here is done.
 
Thanks for the feedbacks and I am glad you've sorted it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top