Jump to content
Sign in to follow this  
Champak

IE browser error window not being detected

Recommended Posts

Champak

AutoIt Window Info sees the window, but WinExists can't.

I've tried the following and neither are seeing it:

If WinExists("Internet Explorer", "Internet Explorer has encountered a problem and needs to close.") Then
        MsgBox(0,0,"test")
        ControlClick("Internet Explorer", "Internet Explorer has encountered a problem and needs to close.", 1001)
    EndIfoÝ÷ Ù©Ýjëh×6    If WinExists("Internet Explorer", "If you were in the middle of something, the information you were working on might be lost") Then
        MsgBox(0,0,"test")
        ControlClick("Internet Explorer", "If you were in the middle of something, the information you were working on might be lost", 1001)
    EndIf

Attached are the images of what is happening. Any ideas/workarounds?

post-12133-1233250605_thumb.jpg

post-12133-1233250826_thumb.jpg

Share this post


Link to post
Share on other sites
PsaltyDS

AutoIt Window Info sees the window, but WinExists can't.

Did you verify the Title with AU3Info? I see it on screenshot, but maybe that's graphical and the real title is not displayed...?

If that doesn't help, go with class (i.e. "[CLASS:#32770]") and the text, instead of the title.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Champak

Yes I did verify the title. And going with class doesn't work either.

Share this post


Link to post
Share on other sites
PsaltyDS

Yes I did verify the title. And going with class doesn't work either.

Interesting. If that is the active window, run this and see what you get:
Sleep(30000); You've got 30 sec to make the error popup active

$hWin = WinGetHandle("[ACTIVE]")
$sTitle = WinGetTitle($hWin)
$sText = WinGetText($hWin)
        
$tBuffer = DllStructCreate("char Buffer[256]")
$pBuffer = DllStructGetPtr($tBuffer)
$iBuffer = DllStructGetSize($tBuffer)
$avRET = DllCall("user32.dll", "int", "GetClassNameA", "hwnd", $hWin, "ptr", $pBuffer, "int", $iBuffer)
$sCLASS = DllStructGetData($tBuffer, "Buffer")

$iExists = WinExists("[CLASS:" & $sCLASS & "]")

$sMsg = "HWND = " & $hWin & @CRLF & _
        "Title = " & $sTitle & @CRLF & _
        "Text = " & $sText & @CRLF & _
        "Class = " & $sCLASS & @CRLF & _
        "Exists = " & $iExists & @CRLF & @CRLF
For $n = 0 To UBound($avRET) - 1
    $sMsg &= "$avRET[" & $n & "] = " & $avRET[$n] & @CRLF
Next

MsgBox(64, "Window", $sMsg)

:)

Edit1: Updated code to get CLASS also.

Edit2: Oops. Raw DLL call was not required to get class. There is a UDF already: _WinAPI_GetClassName()

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Champak

Here is the result...same info as the info window.

post-12133-1233269341_thumb.jpg

Share this post


Link to post
Share on other sites
PsaltyDS

Here is the result...same info as the info window.

Try: WinWait("[CLASS:#32770; TITLE:Internet Explorer]")

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Champak

Are you saying that to test to see if the same thing happens, or to use it in place of "Exists"? Because "Wait" wont work for what I'm doing, the "Exists" is going in the main loop.

Share this post


Link to post
Share on other sites
PsaltyDS

Are you saying that to test to see if the same thing happens, or to use it in place of "Exists"? Because "Wait" wont work for what I'm doing, the "Exists" is going in the main loop.

Just a dumb typo on my part: I meant use that match string in WinExsists().

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Champak

So here is what my tests have shown.

1/ The problem happens either during navigate or loadwait

2/ The winExists is not being seen in the loop because the function is not ending and going back to the loop.

3/ This only happens when the DebugBar toolbar is open...even when the window is hidden.

So I believe I would have to put the WinExists() in the LoadWait() function itself in the While loops. Is that correct?...not able to test it now.

Share this post


Link to post
Share on other sites
PsaltyDS

So here is what my tests have shown.

1/ The problem happens either during navigate or loadwait

2/ The winExists is not being seen in the loop because the function is not ending and going back to the loop.

3/ This only happens when the DebugBar toolbar is open...even when the window is hidden.

So I believe I would have to put the WinExists() in the LoadWait() function itself in the While loops. Is that correct?...not able to test it now.

No. If the problem is blocking of the script then use the $f_wait = False option and so your script can continue while it loads/navigates the page. Do your own non-blocking check for "busy" with _IEPropertyGet() or maybe _IELoadWait($oIE, 0, 100), in the same loop you watch for the popup with.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Champak

I don't know if this is what you meant, but this is what I did. I replaced the _IELoadWait() with a function call to the following:

Func _LoadWait_ErrorTEST()
    _ConsoleWrite(">!!!!! LOAD WAIT")

    $Timeout = 0
    Do 
        Sleep(1000)
        $Timeout += 1
        ;If WinExists("[CLASS:#32770; TITLE:Internet Explorer]") Then   
        If WinExists("Internet Explorer", "Internet Explorer has encountered a problem and needs to close.") Then
            _ConsoleWrite("! IE Error Window Pop Up ===========================================")
            ControlClick("[CLASS:#32770]", "Internet Explorer has encountered a problem and needs to close.", 1001)
        EndIf
        $busy = _IEPropertyGet ( $oIE, "busy" )
        ConsoleWrite("- busy loading: " & $busy & @CRLF)
    Until $busy = 0 Or $Timeout = 60
    
EndFunc

If this is what you meant(or something like it), it doesn't work. It is getting stuck at the _IEPropertyGet() WHEN that pop up window shows up; and again, the window only pops up when the debugbar is open in the toolbar in IE.

It seems the only way to fix this is to have a helper app look for this pop up window and close it so the main app can continue...or do you have another suggestion.

Edited by Champak

Share this post


Link to post
Share on other sites
PsaltyDS

I don't know if this is what you meant, but this is what I did. I replaced the _IELoadWait() with a function call to the following:

Func _LoadWait_ErrorTEST()
    _ConsoleWrite(">!!!!! LOAD WAIT")

    $Timeout = 0
    Do 
        Sleep(1000)
        $Timeout += 1
    ;If WinExists("[CLASS:#32770; TITLE:Internet Explorer]") Then   
        If WinExists("Internet Explorer", "Internet Explorer has encountered a problem and needs to close.") Then
            _ConsoleWrite("! IE Error Window Pop Up ===========================================")
            ControlClick("[CLASS:#32770]", "Internet Explorer has encountered a problem and needs to close.", 1001)
        EndIf
        $busy = _IEPropertyGet ( $oIE, "busy" )
        ConsoleWrite("- busy loading: " & $busy & @CRLF)
    Until $busy = 0 Or $Timeout = 60
    
EndFunc

If this is what you meant(or something like it), it doesn't work. It is getting stuck at the _IEPropertyGet() WHEN that pop up window shows up; and again, the window only pops up when the debugbar is open in the toolbar in IE.

It seems the only way to fix this is to have a helper app look for this pop up window and close it so the main app can continue...or do you have another suggestion.

I meant more like this (_IEPropertyGet() was probably a bad suggestion on my part):
Func _LoadWait_ErrorTEST()
    _ConsoleWrite(">!!!!! LOAD WAIT" & @LF)

    $iTimer = TimerInit()
    While 1
        Sleep(500)
        If WinExists("Internet Explorer", "Internet Explorer has encountered a problem and needs to close.") Then
            _ConsoleWrite("! IE Error Window Pop Up ====================================")
            ControlClick("[CLASS:#32770]", "Internet Explorer has encountered a problem and needs to close.", 1001)
        EndIf
        If _IELoadWait($oIE, 250, 250) Then 
            ConsoleWrite("IE done loading: " & Round(TimerDiff($iTimer) / 1000) & "sec" & @LF)
        ElseIf TimerDiff($iTimer) >= 60000; 60sec timeout           
            ConsoleWrite("60sec timeout expired!" & @LF)
            ExitLoop
        Else
            ConsoleWrite("IE busy loading: " & Round(TimerDiff($iTimer) / 1000) & "sec" & @LF)
        Else
    WEnd
EndFunc  ;==>_LoadWait_ErrorTEST

This should check every 1sec for about 60secs.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Champak

Nope. That's a no go as well :).

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  

×