+ Reply to Thread
Results 1 to 1 of 1

VB macro to click after logging Page button with attribute Value

Hybrid View

  1. #1
    Registered User
    Join Date
    07-19-2013
    Location
    India
    MS-Off Ver
    excel 2010
    Posts
    4

    VB macro to click after logging Page button with attribute Value

    Hi all,

    The below is my javescript code, I am trying to do some automation,

    I have successfully logging the site but after logging page I want to click another button called “View All”

    I have used same code which I used to click logging button, but that code is not working to click view all button.

    I have not understating why this code is not working thanks for advice me on same.


    [code]
    div id="Fund_List" class="autoGrid" style="width=100%;">
    <div id="aGrid" style="overflow=auto; width:100%; height:expression(document.body.clientHeight-120);" >
    	<table width="100%" cellspacing="0" border="0">
    		<thead class="gridHeader">
    			<th align=left style="width:250px" class="ag_headerCell" id="ListHdr">Fund List Name</th>
    			<th align=left style="width:250px" id="ListDescHdr" class="ag_headerCell" >Fund List Description</th>
    			<th class="ag_headerCell">&nbsp;</th>
    		</thead> 
    		<tbody id="fundlist"  valueSrc="FUND_ID" textSrc="FUND_ID"  >
    		</tbody>               
    	</table>		
    </div> 
    <div id="buttonDiv" style="overflow=auto; width=100%; height:90;" >
    <table width=100% class="ag_footer" cellspacing="7">
    <tr align=left><td>
    <button onclick="addFundList()" style="cursor:hand;width:120px">Create Fund List</button>&nbsp;&nbsp;
    <button onclick="joinFundList()" style="cursor:hand;width:120px">Join Fund List</button>&nbsp;&nbsp;
    <button onclick="refreshFavScr()" style="cursor:hand;width:120px">View Favourites</button>&nbsp;&nbsp;
    <button onclick="refreshScr()" style="cursor:hand;width:120px">View All</button>&nbsp;&nbsp;
    <button onclick="searchLists()" style="cursor:hand;width:120px">Search Lists</button>&nbsp;&nbsp;
    </td></tr>
    <tr align=left><td>
    <button id="FASBfundElectn" onclick="viewFASBFundElection()" style="cursor: hand;width:120px">FASB Fund Election</button>&nbsp;&nbsp;
    <button id="FASBclientElectn" onclick="viewFASBClientElection()" style="cursor: hand;width:120px">FASB Client Election</button>&nbsp;&nbsp;
    <button id="config" onclick="viewConfiguration()" style="cursor: hand;width:120px">FASB Configuration</button>
    </td></tr>
     </table>
    </div>
    
    
    
    function refreshScr(){
    		mode="ALL";
    		for (var i=0;i<document.all.length;i++)
    		{
    			document.all[i].style.cursor='wait';
    		}
     
    		var selectColl = document.getElementsByTagName("SELECT");
    		for (var i = 0, s; s = selectColl[i]; i++)
    		{
              if (!s.disabled)
              {
                  s.disabled = true;
    		  }
    		}
    		document.search.action="/ehorizon/fundlist-browse-all.do";
    		document.search.submit();
    		//window.location.reload();
     
    [\code]
    Excel Vb code
    
    
    Sub ehorizonLogin()
    
    
    'Dim IE As Object
    Dim doc As HTMLDocument
    
    Dim IE As InternetExplorer
    Set IE = New InternetExplorer
    Dim att As HTMLAttributeCollection
    Dim coll As HTMLElementCollection
    Dim ele As HTMLHtmlElement
    
    
    
    'On Error GoTo Err_Clear
    IE.navigate "site"
    IE.Visible = True
    
    Set doc = IE.document
    
    
    Do
    ' Wait till the Browser is loaded
    Loop Until IE.readyState = READYSTATE_COMPLETE
    
    doc.getElementById("name").Value = "C501"
    doc.getElementById("id").Value = "A00000"
    doc.getElementById("passwd").Value = "XXXXX"
    doc.onclick = "loginValidate()"
    
    For Each ele In doc.getElementsByTagName("button")
    If ele.getAttribute("value") = ("LOGIN") Then
    ele.Click: End If
    
    Do
    ' Wait till the Browser is loaded
    Loop Until IE.readyState = READYSTATE_COMPLETE
    IE.Refresh
    
    Dim vele As HTMLHtmlElement
    Dim doc1 As HTMLDocument
    Set doc1 = IE.document
    
    For Each vele In doc.getElementsByTagName("button")
    If vele.getAttribute("value") = ("View All") Then
    vele.Click: End If
    
    
    Next
    Next
    'Err_Clear:
    'If Err <> 0 Then
    'Debug.Assert Err = 0
    'Err.Clear
    'Resume Next
    'End If
    
    End Sub
    Moderator Note:

    Pls use code tags around your code next time as per forum rules.
    Last edited by shreekant; 09-18-2013 at 02:01 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Cant Get my macro to click a Button
    By pulkit lila in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2012, 03:59 PM
  2. [SOLVED] How do I run the macro for a button click without clicking the button?
    By flyboy54 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-12-2012, 10:45 AM
  3. Logging to a web page
    By degreez in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-28-2010, 02:47 AM
  4. Move the page with button click?
    By horton in forum Excel General
    Replies: 1
    Last Post: 07-05-2008, 01:11 PM
  5. Macro to Click Button?
    By Chronichalt@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2006, 07:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1