Wait until specific value appears in selenium excel vba

前端 未结 2 523
名媛妹妹
名媛妹妹 2021-01-26 21:24

I have an element with this html

<
相关标签:
2条回答
  • 2021-01-26 22:17

    I have tried this solution and it worked well for me This was with the help of Ziggus' suggestion

            Do Until .FindElementById("ContentPlaceHolder1_Label2").Text = "تم حفظ التعديل بنجاح"
            Application.Wait Now() + TimeValue("00:00:01")
        Loop
    
    0 讨论(0)
  • 2021-01-26 22:24

    I would re-write this as you risk an infinite loop. Make it a timed loop and add in a DoEvents.

    Dim result As String, testElement As Object, t As Date
    Const MAX_WAIT_SEC As Long = 10 '<==adjust time here
    t = Timer
    Do
        DoEvents
        On Error Resume Next
        Set testElement = .FindElementById("ContentPlaceHolder1_Label2")
        result = testElement.Text
        If Timer - t > MAX_WAIT_SEC Then Exit Do
        On Error GoTo 0
    Loop While result <> "تم حفظ التعديل بنجاح"
    
    0 讨论(0)
提交回复
热议问题