Jump to content

Recommended Posts

Posted (edited)

Hi community

Inside a agressive loop that run while loading a web page I sometime got an error while retreiving an attribute of tag object

My error handling does'nt seem to work, have you any ideay on how to handle this ?

The code that generate the error

If IsObj ( $oCollection_Modal_Dialogue ) Then
    For $oElement_Modal_Dialogue In $oCollection_Modal_Dialogue         
        $sValue_Read_Modal_Dialogue = $oElement_Modal_Dialogue.getAttribute ( $sAttrib_Modal_Dialogue )
        If Not @error Then
            If $sValue_Read_Modal_Dialogue == $Value_Modal_Dialogue Then
                $bModal_Dialogue = True
                ExitLoop
            EndIf
        Else
            Return SetError (1, 0, 'Erreur sur $oElement_Modal_Dialogue.getAttribute ( $sAttrib_Modal_Dialogue )' )
        EndIf
    Next
    If $bModal_Dialogue == False Then
        Console ( "MSG", $sFunction_Name, 'Sortie de "' & $sFunction_Name & '" >>"' )
        Return SetError (1, 0, 'Pas de "Modal Dialogue" box' )
    EndIf
Else
    Console ( "MSG", $sFunction_Name, 'Sortie de "' & $sFunction_Name & '" >>"' )
    Return SetError (1, 0, 'Pas de "Modal Dialogue" box' )
EndIf

The error returned

$sValue_Read_Modal_Dialogue = $oElement_Modal_Dialogue.getAttribute ( $sAttrib_Modal_Dialogue )
$sValue_Read_Modal_Dialogue = $oElement_Modal_Dialogue^ ERROR

Regards

Edited by Ebola57
Posted

You need to set up a COM Error handler... take a look at the help page for ObjEvent

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

  Reveal hidden contents
Posted (edited)

Look in my signature.

To be more accurate 

 

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...