Jump to content

How to understand that the page is loaded?


Recommended Posts

Hello.
After going over $ sUrl, starts working JS, its working time is always different, so I used the function Sleep($ max).
Only this greatly slows down the script. I wrote the function Povtor($ sDivId), but here's the error:
-> IE.au3 T3.0-2 Warning from function _IEGetObjById, $ _IESTATUS_NoMatch (bloodrain)
Please help solve this problem without using sleep ().

Local $oIE = _IECreate($sUrl)

Povtor("bloodrain")

Func Povtor($sDivId)
    While Sleep(500)
        Local $oDiv = _IEGetObjById($oIE, $sDivId)
        If IsObj($oDiv) Then
            _IEAction($oDiv, "click")
            _IELoadWait($oIE)
        Else
            ExitLoop
        EndIf
    WEnd
EndFunc

 

Link to comment
Share on other sites

Could you show the DOM area of the object "bloodrain" ?

Beside it is just a warning not an error !

Use this :

Local $oIE = _IECreate($sUrl)

ConsoleWrite (Povtor("bloodrain") & @CRLF)

Func Povtor($sDivId)
Local $Count = 0
    While True
        Sleep(100)
        Local $oDiv = _IEGetObjById($oIE, $sDivId)
        If IsObj($oDiv) Then
            _IEAction($oDiv, "click")
            _IELoadWait($oIE)
            Return True
        Else
            $Count += 1
            if $Count > 500 then return False
        EndIf
    WEnd
EndFunc

 

Edited by Nine
Link to comment
Share on other sites

4 minutes ago, Nine said:

Could you show the DOM area of the object "bloodrain" ? 

<a href="" class="off_tap" onclick="return endBTTiming()">
    <div id="bloodrain">
        <div>
            <div>
                <img src="src/die_msg153.png" alt="">
                    <div>Нажмите, чтобы продолжить..</div>
            </div>
        </div>
    </div>
</a>

Do you need the code for the whole page?

Link to comment
Share on other sites

32 minutes ago, Nine said:

Beside it is just a warning not an error !

Yes, a warning. My script runs faster than JS works, and does not find the "bloodrain" object. If use
then everything works, but I don’t like it ....

Local $oIE = _IECreate($sUrl)
_IELoadWait($oIE)
Sleep(60000)
 Local $oDiv = _IEGetObjById($oIE, $sDivId)
        If IsObj($oDiv) Then
            _IEAction($oDiv, "click")
            _IELoadWait($oIE)
        Else
            ExitLoop
        EndIf

 

Link to comment
Share on other sites

Link to comment
Share on other sites

16 minutes ago, Nine said:

Try the code I gave you.  Make the count the value you want.  Also you can disable notification with _IEErrorNotify (False) function temporary. 

Yes, the code works!

Thanks! Thanks! Thanks!

Can I turn off notifications directly in the body of the Povtor () function?

Link to comment
Share on other sites

Link to comment
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
 Share

  • Recently Browsing   0 members

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