Using TAB CLOSE in VBA opens URL in wrong browser

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Using TAB CLOSE in VBA opens URL in wrong browser

by Ske on Mon Apr 13, 2015 2:49 pm

Can't figure this one out, in fact it's hard to explain the issue.

This is a simplified version of my code that causes this issue, for easier reproduction:
Code: Select all
Private Sub UndueBrowserOpenTestClean()

    Set iim1 = CreateObject("imacros")
    iret = iim1.iimInit

    For rowHtm = 2 To 100

        strURL = "http://www.continente.pt/stores/continente/pt-pt/public/Pages/ProductDetail.aspx?ProductId=2422596"

        macro = ""
        macro = "TAB OPEN" + vbNewLine
        macro = macro + "TAB CLOSE" + vbNewLine
        'macro = macro + "WAIT SECONDS=1" + vbNewLine
        macro = macro + "SET !TIMEOUT_PAGE 30" + vbNewLine
        macro = macro + "URL GOTO=" & strURL & "" + vbNewLine
        'macro = macro + "WAIT SECONDS=1" + vbNewLine

RetryExtraction:
        macro = macro + "SET !TIMEOUT_STEP 1" + vbNewLine
        macro = macro + "TAG POS=1 TYPE=DIV ATTR=ID:breadcrumbNavigation EXTRACT=TXT" + vbNewLine

        Status = iim1.iimPlayCode(macro)

        strBreadcrumb = iim1.iimGetLastExtract(1)
        If strBreadcrumb = "#EANF#" Then
            macro = "WAIT SECONDS=1" + vbNewLine
            GoTo RetryExtraction
        End If
    Next rowHtm

End Sub


The code uses the Imacros browser (v10) and runs fine, but every once in a while the URL opens both in the Imacros and the default browser (IE or chrome on different computers). In the default browser nothing happens with it, only an additional tab gets opened, but that means that after some time I have 50+ tabs open in the default browser, so eventually something crashed.

I've already experimented quite a bit with it, the issue happens in
  • Win 8, Win 7, Win Vista
  • Excel 2013 and 2010 (both 32 bit)
  • with different extracts
  • with default browsers
  • running the imacros code in different steps, eg separately close tabs, open URL, extract data in individual macros
  • adding WAIT SECONDS lines

What does prevent the issue is avoiding any TAB CLOSE lines in the code. (The reason I don't want to do that is that in my real code I loop through different ProductID= numbers, and sometimes the extract contains the results from the previous URL, apparently because the extraction is made before the new URL is fully done loading)

Another symptom: while the URL in the address bar of the Imacros browser lists correctly as e.g:
continente.pt/stores/continente/pt-pt/public/Pages/ProductDetail.aspx?ProductId=2422596
in the default browser it appears as either:

continente.pt/stores/continente/pt-pt/public/Pages/ProductDetail.aspx?ProductId=2422596%20-#http%3A%2F%2Fwww.continente.pt

or

continente.pt/stores/continente/pt-pt/public/Pages/ProductDetail.aspx?ProductId=2422596%20-#iit=1428959468621&tmr=load%3D1428959468565%26core%3D1428959468592%26main%3D1428959468597%26ifr%3D1428959468624&cb=0&cdn=0&kw=&ab=-&dh=www.continente.pt&dr=&du=http%3A%2F%2Fwww.continente.pt%2Fstores%2Fcontinente%2Fpt-pt%2Fpublic%2FPages%2FProductDetail.aspx%3FProductId%3D2422596&href=http%3A%2F%2Fwww.continente.pt%2Fstores%2Fcontinente%2Fpt-pt%2Fpublic%2FPages%2FProductDetail.aspx&dt=Cerveja%20com%20%C3%81lcool%20-%20Erdinger%20-%20Continente%20Online&dbg=0&cap=tc%3D0%26ab%3D0&inst=1&jsl=1&prod=true&lng=en-GB&ogt=&pc=men&pub=&ssl=0&sid=552c30ecd7ee350a&srpl=1&srcs=1&srd=1&srf=1&srx=1&ver=300&xck=0&xtr=0&og=&aa=0&csi=undefined&toLoJson=uvs%3D552c265e80bb33cc039%26chr%3Dutf-8%26md%3D0%26vcl%3D3&rev=v1.1.1-wp&ct=1&xld=1&xd=1
Ske
 
Posts: 6
Joined: Wed Jan 13, 2010 4:45 am

Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: Bing [Bot] and 4 guests

-->