G33kDude / Chrome.ahk

Automate Google Chrome using native AutoHotkey
https://autohotkey.com/boards/viewtopic.php?t=42890
MIT License
336 stars 82 forks source link

WaitForLoad for a limited period of time? #40

Open murataygunn opened 11 months ago

murataygunn commented 11 months ago

When the server is under heavy load its response took about two minutes. WaitForLoad function takes too long for application. How can wait for about 20 seconds and throw exception? I tried this; WaitForLoadForXSeconds(DesiredState:="complete", Interval:=100, forXSeconds:= 10) { forXSeconds := forXSeconds * 1000 donguBaslamaAni := A_TickCount while (this.Evaluate("document.readyState").value != DesiredState) { Sleep, Interval if ((A_TickCount - donguBaslamaAni) > 300) { Throw Exception ("Sayfa yanıt vermiyor.") Return } } }

But didnt worked.