+ Reply to Thread
Results 1 to 5 of 5

Javascript Progress Bar Web Automation

Hybrid View

plasma33 Javascript Progress Bar Web... 08-20-2012, 09:40 PM
Chippy Re: Javascript Progress Bar... 08-21-2012, 07:29 AM
plasma33 Re: Javascript Progress Bar... 08-21-2012, 09:04 AM
Chippy Re: Javascript Progress Bar... 08-24-2012, 12:25 PM
plasma33 Re: Javascript Progress Bar... 08-30-2012, 10:29 PM
  1. #1
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Javascript Progress Bar Web Automation

    Hi Guys,

    I am trying to automate a webpage through macro. But facing some problems. I actually want to control the page with help of the progress bar.

    Here is the code for the progress bar->

    <div class="icePnlGrp" id="form:j_idt11:0:j_idt152"><table class="iceOutProg" id="form:j_idt11:0:progressGlobal" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td><div class="iceOutProgBg" style="position:relative;"><div class="iceOutProgFill" id="form:j_idt11:0:progressGlobalbar" style="position:absolute;width:0%;"></div><div class="iceOutProgTxt" style="text-align:center;position:relative;background-color:transparent;width:100%;z-index:1;">MetFusion Progress: Retrieval - 0%</div></div></td></tr></tbody></table>
    Can we do something like for example->
        
    Do Until IE.Document.getElementsByTagName("DIV").value = "MetFusion Progress: Retrieval - 100%"
          DoEvents
    Loop
    Thanks in advance guys.

    Cheers
    plasma33

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Javascript Progress Bar Web Automation

    Try this:

    Do Until IE.Document.getElementById("form:j_idt11:0:progressGlobal").innerText = "MetFusion Progress: Retrieval - 100%"
          DoEvents
    Loop
    But it's difficult to know if this will work without seeing the web page itself, for which we need the URL.
    Post responsibly. Search for excelforum.com

  3. #3
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Re: Javascript Progress Bar Web Automation

    Thanks for your kind reply. The above code you gave me did not work. Here is the URL for the webpage->
    http://msbi.ipb-halle.de/MetFusion/

    Actually I need to extract some URLs from the second tab i.e. the Query Result tab and it happens only when the Retrieval is 100%. The Query Result tab only comes up when you start and finish the Retrieval. Here is a bit of code that I am trying to implement->

    Dim l As Integer
    Dim d As Object
    
        Set InputCollections = IE.Document.getElementsByTagName("INPUT")
            l = 0
            While l < InputCollections.Length
                If InputCollections(l).VALUE = "Start" Then Set d = InputCollections(l)
                l = l + 1
            Wend
        
        Do While IE.Busy And IE.ReadyState <> 4: DoEvents: Loop
        On Error Resume Next
        Do While Not IE.Document.ReadyState = "complete": DoEvents: Loop 'not available if [.Visible = False]
        Err.Clear
        d.Click
        
    Do Until IE.Document.getElementById("form:j_idt11:0:progressGlobal").innerText = "MetFusion Progress: Retrieval - 100%"
          DoEvents
    Loop
               
        Dim STRtxt As String
        ' List the links.
        On Error Resume Next
            Set HTMLdoc = IE.Document
                For Each HTMLlinks In HTMLdoc.Links
                    STRtxt = STRtxt & HTMLlinks.href & vbCrLf
                Next HTMLlinks
        Worksheets("Sheet4").Range("A2") = STRtxt
           
        Application.Wait (Now + TimeValue("0:00:05"))
        'MsgBox "Done"
        IE.Visible = True


    Cheers
    plasma33

  4. #4
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Javascript Progress Bar Web Automation

    Quote Originally Posted by plasma33 View Post
    Actually I need to extract some URLs from the second tab i.e. the Query Result tab and it happens only when the Retrieval is 100%. The Query Result tab only comes up when you start and finish the Retrieval.
    I had a look at this and was unable to detect the progress bar at 100% or not showing 'running'.

    Instead, try checking for the Query Results tab being the active tab, which only happens when the results are complete, unless you manually click it when the calculation is still running.

    EDIT Even simpler, wait until the results table exists:
        Dim resultsTable As HTMLTable
        Set resultsTable = Nothing
        While resultsTable Is Nothing
            Set resultsTable = IE.document.getElementById("form:j_idt11:0:tableCluster")
            If resultsTable Is Nothing Then Application.Wait DateAdd("s", 1, Now)
            DoEvents
        Wend
    Last edited by Chippy; 08-24-2012 at 12:39 PM. Reason: Thought of a simpler technique

  5. #5
    Forum Contributor
    Join Date
    06-20-2011
    Location
    Auckland, NZ
    MS-Off Ver
    Excel 2013
    Posts
    165

    Re: Javascript Progress Bar Web Automation

    yipeeeee....your code its working perfectly Chippy...thanks heaps......

    Cheers
    plasma33

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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