I want to add Wait Method.(SeleniumVBA's TimerWait Method)
Public Sub Wait(Optional ByVal milliseconds As Long = 300)
'pause in milliseconds
Dim startTime As Single, endTime As Single, nowTime As Single, elapsedTime As Single
startTime = VBA.Timer()
endTime = startTime + milliseconds / 1000#
Do While nowTime < endTime
nowTime = VBA.Timer()
If nowTime < startTime Then 'oops - someone is burning the midnight oil!
endTime = endTime - elapsedTime
startTime = 0
End If
elapsedTime = nowTime - startTime
DoEvents 'yield to other processes.
Loop
End Sub
It also worked on Mac.
Debug.Print Now
Driver.Wait 5000
Debug.Print Now
’2022/05/28 21:24:02
’2022/05/28 21:24:07
I modified it by referring to SeleniumVBA's Execute Method,
Public Function Execute
' Set params to path
Dim cmdArgs As New Dictionary
Dim paramKey As Variant
For Each paramKey In parameters.Keys
If InStr(path, "$" & paramKey) > 0 Then 'path parameter
path = Replace(path, "$" & paramKey, parameters(paramKey))
Else 'non-path parameter
cmdArgs.Add paramKey, parameters(paramKey)
End If
Next
If cmdArgs.Exists("sessionId") Then cmdArgs.Remove "sessionId"
' Send request to selenium server
Dim resp As Dictionary
Set resp = SendRequest(method, UrlBase + path, cmdArgs)
I want to add Wait Method.(SeleniumVBA's TimerWait Method)
It also worked on Mac.
In relation to the timer. Previously, when I added SetPageLoadTimeout, I got the following error. Error 513 「invalid argument value must be a non-negative integer」 https://qiita.com/yaju/items/9d1f189a5d2118a3f4d3#comment-66636c3d7ded6b6e14de
I modified it by referring to SeleniumVBA's Execute Method,