Skip to content

Commit 8f62b99

Browse files
authored
DemoCookies() waits on NID cookie existence (#370)
1 parent ec4d483 commit 8f62b99

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

wd_demo.au3

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,13 @@ Func DemoCookies()
469469
ConsoleWrite("wd_demo.au3: (" & @ScriptLineNumber & ") : Cookies (obtained at start after navigate) : " & $sAllCookies & @CRLF)
470470

471471
ConsoleWrite("wd_demo.au3: (" & @ScriptLineNumber & ") : WD: Get 'NID' cookie:" & @CRLF)
472-
Local $sNID = _WD_Cookies($sSession, 'Get', 'NID')
472+
Local $hTimer = TimerInit()
473+
Local $sNID
474+
While 1
475+
$sNID = _WD_Cookies($sSession, 'Get', 'NID')
476+
If Not @error Or TimerDiff($hTimer) > 5 * 1000 Then ExitLoop
477+
Sleep(100) ; this cookie may not exist at start, may appear later when website will be estabilished, so there is need to wait on @error and try again
478+
WEnd
473479
ConsoleWrite("wd_demo.au3: (" & @ScriptLineNumber & ") : Cookie obtained 'NID' : " & $sNID & @CRLF)
474480

475481
Local $sName = "TestName"

0 commit comments

Comments
 (0)